Skip to content
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

improve redirect after login #435

Merged
merged 1 commit into from
Jul 13, 2016
Merged

improve redirect after login #435

merged 1 commit into from
Jul 13, 2016

Conversation

deiucanta
Copy link
Contributor

Instead of checking for explicit routes, this tries to exclude any unwanted routes and store anything else. All of the following 5 conditions have to be met in order to save the current path

  1. User must not be logged in (saves some resources)
  2. Route must not be /login (you don't want to get back to login after login)
  3. Route must not be /signup (same reason as above)
  4. Route must not start with /auth (same reason as above)
  5. Path does not contain a dot (this usually matches a file and you don't want to be redirected to favicon.ico)

@vincentbriglia
Copy link

since passport is prevalently used, wouldn't https://github.com/jaredhanson/connect-ensure-login be a better option ?

@sahat sahat merged commit 3399bfd into sahat:master Jul 13, 2016
@sahat
Copy link
Owner

sahat commented Jul 13, 2016

Thanks for the pull request and sorry about the delay in merging it.

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.

3 participants