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

Fix 405 issue #30

Merged
merged 3 commits into from
Apr 14, 2018
Merged

Fix 405 issue #30

merged 3 commits into from
Apr 14, 2018

Conversation

sparklespdx
Copy link
Contributor

Instead of rendering the login template on 401s, we redirect to the
login page. The login page will now redirect to ?next after it has
validated the URL is safe and logged the user in. This fixes the issue
with trying to log in from pages that aren't /login.

This is a pretty standard way of doing this, we're checking against the host header to make sure the URL belongs to us and it serves 400s for bad URLs.

Signed-off-by: Josh Farwell [email protected]

Instead of rendering the login template on 401s, we redirect to the
login page. The login page will now redirect to ?next after it has
validated the URL is safe. This fixes the issue with trying to log
in from pages that aren't /login.

Signed-off-by: Josh Farwell <[email protected]>
We want to avoid circular imports so we instantiate login_manager in
views and then initialize it in application.py.

Signed-off-by: Josh Farwell <[email protected]>
Turns out that Flask-Login implements the redirect chain by itself. It
doesn't validate the redirect URL though.

Signed-off-by: Josh Farwell <[email protected]>
@tmthyjames tmthyjames merged commit ded82de into tmthyjames:master Apr 14, 2018
@sparklespdx sparklespdx deleted the login-405 branch April 14, 2018 21:50
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