small refacto

This commit is contained in:
Son NK 2020-02-27 22:26:29 +07:00
parent 659861198b
commit 9d23fc5ab3
1 changed files with 5 additions and 1 deletions

View File

@ -45,6 +45,10 @@ def auth_login():
elif not user.activated:
return jsonify(error="Account not activated"), 400
return jsonify(**auth_payload(user, device)), 200
def auth_payload(user, device) -> dict:
ret = {
"name": user.name,
"mfa_enabled": user.enable_otp,
@ -64,4 +68,4 @@ def auth_login():
ret["mfa_key"] = None
ret["api_key"] = api_key.code
return jsonify(**ret), 200
return ret