From: Matías Aguirre Date: Sun, 3 Jul 2011 19:42:28 +0000 (-0300) Subject: Redirect new users to properly. Closes gh-98 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=a4075b1095955d2d7254413092efecd922545119;p=django-social-auth.git Redirect new users to properly. Closes gh-98 --- 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