Skip to content

fix: verification redirect base url #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2023
Merged

Conversation

Benehiko
Copy link
Contributor

@Benehiko Benehiko commented Mar 31, 2023

Redirecting to the /verification route with a base URL would cause problems since the redirect would be to the root of the URL and not the base path of the URL.

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

@Benehiko Benehiko requested a review from jonas-jonas March 31, 2023 12:23
Comment on lines +83 to +85
const baseUrl = req.path.split("/")
// get rid of the last part of the path (e.g. "login")
baseUrl.pop()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe a bit overkill and just a simple res.redirect("verification") might've been suffice. But I added this in case the application was hosted with a base URL added to the router.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could add that comment to the code as well. This will lead to confusion down the future.

@Benehiko Benehiko self-assigned this Mar 31, 2023
Copy link
Member

@jonas-jonas jonas-jonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment on lines +83 to +85
const baseUrl = req.path.split("/")
// get rid of the last part of the path (e.g. "login")
baseUrl.pop()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could add that comment to the code as well. This will lead to confusion down the future.

@Benehiko Benehiko merged commit 21fdefa into master Apr 3, 2023
@Benehiko Benehiko deleted the fix-verification-redirect branch April 3, 2023 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants