fix invalid auth response

This commit is contained in:
bakatrouble 2025-08-01 09:34:54 +03:00
parent 94184f8635
commit cf9aad9aee

View File

@ -70,7 +70,7 @@ def protected(wrapped):
@validate(json=LoginRequest) @validate(json=LoginRequest)
async def login(_, body: LoginRequest): async def login(_, body: LoginRequest):
if not pbkdf2_sha256(10000, salt=b'salt').verify(body.password, api_auth.get(body.username)): if not pbkdf2_sha256(10000, salt=b'salt').verify(body.password, api_auth.get(body.username)):
return {'status': 'error', 'message': 'Invalid username or password'} return jsonr({'status': 'error', 'message': 'Invalid username or password'})
return jsonr({ return jsonr({
'token': jwt.encode({}, api_secret, algorithm='HS256'), 'token': jwt.encode({}, api_secret, algorithm='HS256'),
}) })