From a4075b1095955d2d7254413092efecd922545119 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Aguirre?= Date: Sun, 3 Jul 2011 16:42:28 -0300 Subject: [PATCH] Redirect new users to properly. Closes gh-98 --- social_auth/views.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/social_auth/views.py b/social_auth/views.py index 3e1e54d..6edfee6 100644 --- a/social_auth/views.py +++ b/social_auth/views.py @@ -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 -- 2.39.5