From: Matías Aguirre Date: Fri, 15 Apr 2011 04:03:55 +0000 (-0300) Subject: Correct user-defined redirect page that overrides django auth app LOGIN_REDIRECT_URL... X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=dd61b8eef31b8d32e6b9c3000a34dd1cfb99e502;p=django-social-auth.git Correct user-defined redirect page that overrides django auth app LOGIN_REDIRECT_URL. Closes gh-47 --- diff --git a/README.rst b/README.rst index 25c8cb8..3e2a9b9 100644 --- a/README.rst +++ b/README.rst @@ -152,6 +152,11 @@ Configuration Check Django documentation at `Login URL`_ and `Login redirect URL`_ + If a custom redirect URL is needed that must be different to LOGIN_URL, + define the setting:: + + SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/another-login-url/' + In case of authentication error, the message can be stored in session if the following setting is defined:: diff --git a/doc/configuration.rst b/doc/configuration.rst index 91bb7bc..5330fe5 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -63,6 +63,11 @@ Configuration Check Django documentation at `Login URL`_ and `Login redirect URL`_ + If a custom redirect URL is needed that must be different to LOGIN_URL, + define the setting:: + + SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/another-login-url/' + In case of authentication error, the message can be stored in session if the following setting is defined:: diff --git a/social_auth/views.py b/social_auth/views.py index 1268e27..521b085 100644 --- a/social_auth/views.py +++ b/social_auth/views.py @@ -11,7 +11,8 @@ from social_auth.backends import get_backend from social_auth.utils import sanitize_redirect -DEFAULT_REDIRECT = getattr(settings, 'LOGIN_REDIRECT_URL', '') +DEFAULT_REDIRECT = getattr(settings, 'SOCIAL_AUTH_LOGIN_REDIRECT_URL', '') or \ + getattr(settings, 'LOGIN_REDIRECT_URL', '') def auth(request, backend): @@ -87,8 +88,7 @@ def disconnect(request, backend): return HttpResponseRedirect(url) -def auth_process(request, backend, complete_url_name, - default_redirect=DEFAULT_REDIRECT): +def auth_process(request, backend, complete_url_name): """Authenticate using social backend""" redirect = reverse(complete_url_name, args=(backend,)) backend = get_backend(backend, request, redirect)