Permalink
Browse files

Merge pull request #190 from spstpl/error_message_patch

Patch for login error message.
  • Loading branch information...
2 parents f28ab09 + 485f68f commit 826e9a778c2d1d89b6657bef937b015c213bf2b9 @omab omab committed Dec 6, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 social_auth/views.py
View
4 social_auth/views.py
@@ -16,6 +16,7 @@
from django.core.urlresolvers import reverse
from django.contrib.auth import login, REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import login_required
+from django.contrib import messages
from django.views.decorators.csrf import csrf_exempt
from social_auth.backends import get_backend
@@ -37,6 +38,7 @@
BACKEND_ERROR_REDIRECT = setting('SOCIAL_AUTH_BACKEND_ERROR_URL',
LOGIN_ERROR_URL)
SANITIZE_REDIRECTS = setting('SOCIAL_AUTH_SANITIZE_REDIRECTS', True)
+ERROR_MESSAGE = setting('LOGIN_ERROR_MESSAGE', None)
def dsa_view(redirect_name=None):
@@ -170,6 +172,8 @@ def complete_process(request, backend, *args, **kwargs):
request.session.pop(REDIRECT_FIELD_NAME, '') or \
DEFAULT_REDIRECT
else:
+ if ERROR_MESSAGE:
+ messages.error(request, ERROR_MESSAGE)
url = LOGIN_ERROR_URL
return HttpResponseRedirect(url)

0 comments on commit 826e9a7

Please sign in to comment.