Skip to content

Commit

Permalink
Merge pull request #190 from spstpl/error_message_patch
Browse files Browse the repository at this point in the history
Patch for login error message.
  • Loading branch information
omab committed Dec 6, 2011
2 parents f28ab09 + 485f68f commit 826e9a7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions social_auth/views.py
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 826e9a7

Please sign in to comment.