diff --git a/api/debian/changelog b/api/debian/changelog index 20c192e8..0d016512 100644 --- a/api/debian/changelog +++ b/api/debian/changelog @@ -1,3 +1,9 @@ +ooni-api (1.0.73) unstable; urgency=medium + + * Return email address on login + + -- Federico Ceratto Wed, 27 Sep 2023 18:35:33 +0200 + ooni-api (1.0.72) unstable; urgency=medium * Fix probe registration iat diff --git a/api/ooniapi/auth.py b/api/ooniapi/auth.py index c4b0a39e..ce729a56 100644 --- a/api/ooniapi/auth.py +++ b/api/ooniapi/auth.py @@ -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) @@ -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")