fix: return auth token as plain text on login

This commit is contained in:
fusion44 2022-10-22 11:45:59 +02:00
parent 3ab007138e
commit f06d84c29f
No known key found for this signature in database
2 changed files with 3 additions and 8 deletions

View file

@ -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()

View file

@ -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