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

Before and after login events #118

Open
mmulich opened this issue Jun 10, 2013 · 3 comments
Open

Before and after login events #118

mmulich opened this issue Jun 10, 2013 · 3 comments

Comments

@mmulich
Copy link

mmulich commented Jun 10, 2013

I'd like to add (feature request) before and after login view events (hook points).

Events on login are useful when using velruse as a plugin or possibly for extending the application. It allows the plugin user to modify/capture information before or after the login view is called; and this is important because there is no way to modify the login view without subclassing the provider. For example, after the login view is hit, one could capture the referrer location so that they could send the authenticated user back to where they came from.

An example implementation can be found at: mmulich@7b52085

@mmerickel
Copy link
Collaborator

Great idea. I wouldn't subclass from NewRequest though. Is there a reason you did that? Events can be any object.

@mmulich
Copy link
Author

mmulich commented Jun 14, 2013

I used NewRequest because it was an easy and document way to get the request in the event object without creating/recreating an event class, but an easy enough thing to change.

Sounds like you're in favor of the feature. Anything you have concerns about? If not, I'll put it together for the various provider classes and submit a pull request.

@mmerickel
Copy link
Collaborator

The feature is good but I think instead of separate subclasses for each provider I will just use a subscriber predicate based on the name of the provider. I've been pondering it as a better way of doing the authentication subclasses as well. I'm thinking something like:

@subscriber('velruse.BeforeLogin', provider_name='google')
def google_login_attempt(event):
    # ...

I'm not sure what to call the PendingLogin event, emitted after the redirect. That one may not be useful?

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