Skip to content

Commit

Permalink
[qa] fix refactoring for response of api/auth/login
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBldy committed Dec 11, 2024
1 parent ba40f4b commit 3600561
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions zou/app/blueprints/auth/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,15 @@ def post(self):

organisation = persons_service.get_organisation()

response = {
"user": user,
"organisation": organisation,
"login": True,
}
response = jsonify(
{
"user": user,
"organisation": organisation,
"login": True,
"access_token": access_token,
"refresh_token": refresh_token,
}
)

if is_from_browser(request.user_agent):
set_access_cookies(response, access_token)
Expand All @@ -245,8 +249,6 @@ def post(self):
events_service.create_login_log(
user["id"], ip_address, "script"
)
response["access_token"] = access_token
response["refresh_token"] = refresh_token
current_app.logger.info(f"User {email} is logged in.")
return response
except WrongUserException:
Expand Down

0 comments on commit 3600561

Please sign in to comment.