]> git.parisson.com Git - django-social-auth.git/commitdiff
Redirect new users to properly. Closes gh-98
authorMatías Aguirre <matiasaguirre@gmail.com>
Sun, 3 Jul 2011 19:42:28 +0000 (16:42 -0300)
committerMatías Aguirre <matiasaguirre@gmail.com>
Sun, 3 Jul 2011 19:42:28 +0000 (16:42 -0300)
social_auth/views.py

index 3e1e54da121a6b7e4ab6a3dffb8ad3d23d79dade..6edfee69a74046f1c152d54873f223dbe476a046 100644 (file)
@@ -67,12 +67,11 @@ def complete_process(request, backend):
             if social_user.expiration_delta():
                 request.session.set_expiry(social_user.expiration_delta())
 
-        url = request.session.pop(REDIRECT_FIELD_NAME, '')
-        if not url:
-            if NEW_USER_REDIRECT and getattr(user, 'is_new', False):
-                url = NEW_USER_REDIRECT
-            else:
-                url = DEFAULT_REDIRECT
+        # Remove URL possible redirect from session, if this is a new account,
+        # send him to the new-users-page if any.
+        url = request.session.pop(REDIRECT_FIELD_NAME, '') or DEFAULT_REDIRECT
+        if NEW_USER_REDIRECT and getattr(user, 'is_new', False):
+            url = NEW_USER_REDIRECT
 
         # store last login backend name in session
         request.session[SOCIAL_AUTH_LAST_LOGIN] = social_user.provider