Skip to content

403: Redirect user to login page if not logged in#785

Merged
SISheogorath merged 1 commit intohackmdio:masterfrom
pferreir:redirect-to-login
May 31, 2018
Merged

403: Redirect user to login page if not logged in#785
SISheogorath merged 1 commit intohackmdio:masterfrom
pferreir:redirect-to-login

Conversation

@pferreir
Copy link
Copy Markdown
Contributor

It's slightly annoying and confusing that I get a 403 error page for a note I can't access, even if I'm not logged in. A common solution in other apps seems to be redirecting the user to the login page. Since there doesn't seem to be a URL I can send the user to in this case, I redirect them to the home page and flash a message asking them to log in.

@SISheogorath SISheogorath added this to the Next release milestone Mar 26, 2018
@SISheogorath SISheogorath added enhancement Wants to improvide an existing feature untested This has not be verified to be working labels Mar 26, 2018
@pferreir pferreir force-pushed the redirect-to-login branch from 21d9197 to 678b57d Compare March 26, 2018 13:52
Comment thread lib/response.js Outdated
if (req.user) {
responseError(res, '403', 'Forbidden', 'oh no.')
} else {
req.flash('error', 'You are not allowed to access this note. Maybe try logging in?')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor nitpick: this might also apply to other pages. Maybe a more general "you are not allowed to access this page" would be alright.

Signed-Off-By: Pedro Ferreira <pedro.ferreira@cern.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Wants to improvide an existing feature untested This has not be verified to be working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants