]> git.parisson.com Git - django-social-auth.git/commitdiff
Send signal for cases where tracking failed registering is needed
authorMatías Aguirre <matiasaguirre@gmail.com>
Fri, 16 Sep 2011 20:56:56 +0000 (17:56 -0300)
committerMatías Aguirre <matiasaguirre@gmail.com>
Fri, 16 Sep 2011 20:56:56 +0000 (17:56 -0300)
social_auth/backends/__init__.py
social_auth/signals.py

index c0be5e65a81beef891997dceaafc0580c9406f8f..c241a60e6a5c4c5617b568ffa69b233aa22e2929 100644 (file)
@@ -33,7 +33,8 @@ from django.db.utils import IntegrityError
 
 from social_auth.models import UserSocialAuth
 from social_auth.store import DjangoOpenIDStore
-from social_auth.signals import pre_update, socialauth_registered
+from social_auth.signals import pre_update, socialauth_registered, \
+                                socialauth_not_registered
 
 
 # OpenID configuration
@@ -111,6 +112,10 @@ class SocialAuthBackend(ModelBackend):
         except UserSocialAuth.DoesNotExist:
             if user is None:  # new user
                 if not CREATE_USERS or not kwargs.get('create_user', True):
+                    # Send signal for cases where tracking failed registering
+                    # is useful.
+                    socialauth_not_registered.send(uid=uid, response=response,
+                                                   details=details)
                     return None
 
                 email = details.get('email')
index 5b2af9e5725900de3c366cd8b2355fdcc33919ca..7e5db38d3b00aeb8fb08220c006f690936aaa422 100644 (file)
@@ -1,7 +1,7 @@
 """Signals"""
 from django.dispatch import Signal
 
-# Pre save signal
+# Pre update signal
 #   This signal is sent when user instance is about to be updated with
 #   new values from services provided. This way custom actions can be
 #   attached and values updated if needed before the saving time.
@@ -18,3 +18,5 @@ from django.dispatch import Signal
 pre_update = Signal(providing_args=['user', 'response', 'details'])
 
 socialauth_registered = Signal(providing_args=['user', 'response', 'details'])
+
+socialauth_not_registered = Signal(providing_args=['uid', 'response', 'details'])