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

Could I redirect complete page to original login page? #137

Closed
geekan opened this issue Jan 1, 2014 · 7 comments
Closed

Could I redirect complete page to original login page? #137

geekan opened this issue Jan 1, 2014 · 7 comments

Comments

@geekan
Copy link

geekan commented Jan 1, 2014

I've searched it for a long time, but I don't find a configuration for it.

@omab
Copy link
Owner

omab commented Jan 1, 2014

I think you are looking for "?next=..." query string parameter.

@geekan
Copy link
Author

geekan commented Jan 1, 2014

I'm using HTTP_REFERER in request.META, but I'm not sure it'll work forever..

@omab
Copy link
Owner

omab commented Jan 1, 2014

@geekan, let's clarify a little, your user is at a page, clicks login and after login he should be back to the original page, is that what you are looking for? If that's the case, build your login URLs to have the current path in a next parameter, like:

<a href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.path }}">Login with Google</a>

@geekan
Copy link
Author

geekan commented Jan 2, 2014

Understand.
I think it can be used as an example like you write, or it may not be easily understand.
And if there is a url like http://www.server.com/?next=http://www.server.com/?page=1?x=2 , will it be redirected correctly?

@omab
Copy link
Owner

omab commented Jan 2, 2014

@geekan, as usual, always escape querystring parameters.

omab added a commit that referenced this issue Jan 2, 2014
@omab
Copy link
Owner

omab commented Jan 2, 2014

@omab omab closed this as completed Jan 2, 2014
@geekan
Copy link
Author

geekan commented Jan 2, 2014

Thanks!

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