From: deyk Date: Wed, 11 Apr 2012 22:19:32 +0000 (-0700) Subject: Adding the `on_cas_login` signal, which is sent just before the final redirect upon... X-Git-Tag: 22.4~34 X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/commitdiff_plain/6548c0a365b3e8f19e18e15e5051134361d254b3?ds=sidebyside;hp=-c Adding the `on_cas_login` signal, which is sent just before the final redirect upon successful login. --- 6548c0a365b3e8f19e18e15e5051134361d254b3 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)