fix invalid auth response
This commit is contained in:
parent
cf9aad9aee
commit
3723280e3d
@ -69,7 +69,8 @@ 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)):
|
hash = api_auth.get(body.username)
|
||||||
|
if not hash or not pbkdf2_sha256(10000, salt=b'salt').verify(body.password, hash):
|
||||||
return jsonr({'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'),
|
||||||
|
Loading…
Reference in New Issue
Block a user