Skip to content

Commit

Permalink
Return email address on login
Browse files Browse the repository at this point in the history
  • Loading branch information
FedericoCeratto committed Oct 5, 2023
1 parent 77b2167 commit 5e5154f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions api/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
ooni-api (1.0.73) unstable; urgency=medium

* Return email address on login

-- Federico Ceratto <[email protected]> Wed, 27 Sep 2023 18:35:33 +0200

ooni-api (1.0.72) unstable; urgency=medium

* Fix probe registration iat
Expand Down
4 changes: 3 additions & 1 deletion api/ooniapi/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def user_register() -> Response:
"exp": expiration,
"aud": "register",
"account_id": account_id,
"email_address": email_address,
"redirect_to": redirect_to,
}
registration_token = create_jwt(payload)
Expand Down Expand Up @@ -373,9 +374,10 @@ def user_login() -> Response:
# Store account role in token to prevent frequent DB lookups
role = _get_account_role(dec["account_id"]) or "user"
redirect_to = dec.get("redirect_to", "")
email = dec["email_address"]

token = _create_session_token(dec["account_id"], role)
return nocachejson(redirect_to=redirect_to, bearer=token)
return nocachejson(redirect_to=redirect_to, bearer=token, email_address=email)


@metrics.timer("user_refresh_token")
Expand Down

0 comments on commit 5e5154f

Please sign in to comment.