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

django login_redirect context processor's value needs escaping #875

Closed
tisdall opened this issue Mar 24, 2016 · 2 comments
Closed

django login_redirect context processor's value needs escaping #875

tisdall opened this issue Mar 24, 2016 · 2 comments

Comments

@tisdall
Copy link

tisdall commented Mar 24, 2016

The value retrieved in login_redirect is automatically un-escaped and needs to be re-escaped in order to be used in a querystring. Currently if the redirect url is something like "/page/?this=that" then the REDIRECT_QUERYSTRING will be "next=/page/?this=that" when it should be "next=/page/%3Fthis%3Dthat".

The way to work around this bug is to use {{ REDIRECT_FIELD_NAME }}={{ REDIRECT_FIELD_VALUE|urlencode }} in templates.

@tisdall
Copy link
Author

tisdall commented Mar 24, 2016

correction... My workaround doesn't work if there's nothing to redirect to. It needs to be instead {% if REDIRECT_FIELD_VALUE %}{{ REDIRECT_FIELD_NAME }}={{ REDIRECT_FIELD_VALUE|urlencode }}{% endif %}

@omab
Copy link
Owner

omab commented Dec 26, 2016

@omab omab closed this as completed Dec 26, 2016
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

No branches or pull requests

2 participants