Opened 10 years ago
Last modified 9 years ago
#5320 new enhancement
Add a logout hook
Reported by: | Boris Bobrov | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description
It could be useful to have a hook in the logout view for authentication plugins.
For example, I've made a plugin to use HTTP Authentication but the logout need to be done externally. I've made the attached patch which allows to redirect to any other internal/external page, but it can be discussed and ameliorated...
Thanks in advance!
Attachment:
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 03a46f7..9f15563 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -120,7 +120,11 @@ def logout(request): # Maybe deleting the user_id parameter would be enough? request.session.delete() - return redirect(request, "index") + response = hook_handle('auth_logout_response', request) + if response: + return response + else: + return redirect(request, 'index')
def verify_email(request):
Change History (2)
comment:1 by , 9 years ago
Milestone: | 0.9.0 |
---|
comment:2 by , 9 years ago
As I now have an account, I can maybe explain a bit where this request come from since it was kindly added by breton for me.
I need this kind of hook to integrate MediaGoblin with the SSO of YunoHost to really log out the user when she/he clicks on "Log out"... However, I'm sure this proposal of patch can be improved and would be glad to discuss that.
Would be nice indeed, but I'm removing enhancements since we're in freeze to 0.9.0. If someone does this though, would be great to merge.