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

Redirect to different pages after login #55

Open
madjar opened this issue Feb 2, 2012 · 0 comments
Open

Redirect to different pages after login #55

madjar opened this issue Feb 2, 2012 · 0 comments

Comments

@madjar
Copy link

madjar commented Feb 2, 2012

The problem

Here's a common use case for which I can't find an elegant solution :

On each page of my application, there is a small login form. Once the person is logged in, I want to redirect him to the page he logged from.

Existing solution

I have found two solutions :

  • Having a view that registers the page to which the user is to be redirected (redirect_to) into the session, depending on the referer. This view then redirect to the velruse view.
  • Having a view that registers redirect_to into the sessions, then call directly the code of velruse's views (something like return request.registry.velruse_providers['github'].login(request)).

Both solutions fell ugly because I have add another view to my application. In the first case /mylogin/{provider} redirects to /login/{provider}. In the second case, /login/{provider} is just plain ignored.

Proposed solution

One solution that seems clean would be to give the possibility to add callbacks or hooks to be called at the beginning of the login views. This would enable one to do any required work and information storage before the login process.

Those hooks would have the ability provide extra data that would be stored in the session during the authentication, then returned as part of AuthenticationComplete, or in the store in the case of the standalone application.

A hook providing simple referer storage would be provided.

Please tell me if you think that solution is ok. If you agree, or if you think code will explain much better than this unclear wall of text, I'll code this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant