From 9d23fc5ab3f9108a0c25a0addea70dd0dca39561 Mon Sep 17 00:00:00 2001 From: Son NK Date: Thu, 27 Feb 2020 22:26:29 +0700 Subject: [PATCH] small refacto --- app/api/views/auth_login.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/views/auth_login.py b/app/api/views/auth_login.py index 55ba87b0..59e78c1c 100644 --- a/app/api/views/auth_login.py +++ b/app/api/views/auth_login.py @@ -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