From f06d84c29f0c585fa7dbbd685c512d2fa865ba81 Mon Sep 17 00:00:00 2001 From: fusion44 Date: Sat, 22 Oct 2022 11:45:59 +0200 Subject: [PATCH] fix: return auth token as plain text on login --- app/auth/auth_handler.py | 8 ++------ tests/repositories/test_system.py | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/auth/auth_handler.py b/app/auth/auth_handler.py index 5f1d314..85a9a54 100644 --- a/app/auth/auth_handler.py +++ b/app/auth/auth_handler.py @@ -17,11 +17,7 @@ def sign_jwt() -> Dict[str, str]: "expires": int(round(time.time() * 1000) + JWT_EXPIRY_TIME), } token = jwt.encode(payload, JWT_SECRET, algorithm=JWT_ALGORITHM) - return token_response(token) - - -def token_response(token: str): - return {"access_token": token} + return token def decodeJWT(token: str) -> dict: @@ -45,7 +41,7 @@ def handle_local_cookie(): if enabled: f = open(full_cookie_file_path, "w") - f.write(sign_jwt()["access_token"]) + f.write(sign_jwt()) f.close() diff --git a/tests/repositories/test_system.py b/tests/repositories/test_system.py index a2c7007..0e856a8 100644 --- a/tests/repositories/test_system.py +++ b/tests/repositories/test_system.py @@ -17,8 +17,7 @@ async def test_login(monkeypatch): res = await sys.login(i=LoginInput(password="12345678")) assert type(res) is dict - assert "access_token" in res - assert res["access_token"].startswith("ey") == True + assert res.startswith("ey") == True async def fake_match_pw_negative(_): return False