Skip to content

Commit

Permalink
Ensure verification redirect includes code
Browse files Browse the repository at this point in the history
For successful email verification attempts, ensure that if the
verification token does not already include a redirect_to address, we
add the `code` query parameter to the redirect with the default
redirect_to URL from the UI config.
  • Loading branch information
scotttrinh committed Mar 5, 2024
1 parent 2072b8c commit a87e21e
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions edb/server/protocol/auth_ext/http.py
Expand Up @@ -1479,20 +1479,17 @@ async def handle_ui_verify(self, request: Any, response: Any):
case _:
maybe_pkce_code = None

match maybe_redirect_to:
case str(rt):
redirect_to = (
_with_appended_qs(
rt,
{
"code": [maybe_pkce_code],
},
)
if maybe_pkce_code
else rt
)
case _:
redirect_to = cast(str, ui_config.redirect_to)
redirect_to = maybe_redirect_to or redirect_to
redirect_to = (
_with_appended_qs(
redirect_to,
{
"code": [maybe_pkce_code],
},
)
if maybe_pkce_code
else redirect_to
)

except errors.VerificationTokenExpired:
app_details_config = self._get_app_details_config()
Expand Down

0 comments on commit a87e21e

Please sign in to comment.