Adding the `on_cas_login` signal, which is sent just before the final redirect upon...
authordeyk <deyk@crossway.org>
Wed, 11 Apr 2012 22:19:32 +0000 (15:19 -0700)
committerdeyk <deyk@crossway.org>
Wed, 11 Apr 2012 22:19:32 +0000 (15:19 -0700)
cas_provider/signals.py
cas_provider/views.py

index be5e2a9..aa939a4 100644 (file)
@@ -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"])
index 675150b..4121a11 100644 (file)
@@ -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)