From 6548c0a365b3e8f19e18e15e5051134361d254b3 Mon Sep 17 00:00:00 2001 From: deyk Date: Wed, 11 Apr 2012 15:19:32 -0700 Subject: [PATCH 1/1] Adding the `on_cas_login` signal, which is sent just before the final redirect upon successful login. --- cas_provider/signals.py | 2 ++ cas_provider/views.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/cas_provider/signals.py b/cas_provider/signals.py index be5e2a9..aa939a4 100644 --- a/cas_provider/signals.py +++ b/cas_provider/signals.py @@ -5,3 +5,5 @@ from django import dispatch on_cas_collect_histories = dispatch.Signal(providing_args=["for_email"]) + +on_cas_login = dispatch.Signal(providing_args=["request", "kwargs"]) diff --git a/cas_provider/views.py b/cas_provider/views.py index 675150b..4121a11 100644 --- a/cas_provider/views.py +++ b/cas_provider/views.py @@ -94,6 +94,12 @@ def login(request, template_name='cas/login.html', success_redirect='/account/', if not user.is_active: errors.append('This account is disabled.') else: + # Send the on_cas_login signal. If we get an HttpResponse, return that. + for receiver, response in signals.on_cas_login(sender=login, request=request, + kwargs=kwargs): + if isinstance(response, HttpResponse): + return response + if service is None: # Try and pull the service off the session service = request.session.pop('service', service) -- 2.20.1