Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #190 from spstpl/error_message_patch

Patch for login error message.
  • Loading branch information...
commit 826e9a778c2d1d89b6657bef937b015c213bf2b9 2 parents f28ab09 + 485f68f
Matías Aguirre omab authored

Showing 1 changed file with 4 additions and 0 deletions. Show diff stats Hide diff stats

  1. +4 0 social_auth/views.py
4 social_auth/views.py
@@ -16,6 +16,7 @@
16 16 from django.core.urlresolvers import reverse
17 17 from django.contrib.auth import login, REDIRECT_FIELD_NAME
18 18 from django.contrib.auth.decorators import login_required
  19 +from django.contrib import messages
19 20 from django.views.decorators.csrf import csrf_exempt
20 21
21 22 from social_auth.backends import get_backend
@@ -37,6 +38,7 @@
37 38 BACKEND_ERROR_REDIRECT = setting('SOCIAL_AUTH_BACKEND_ERROR_URL',
38 39 LOGIN_ERROR_URL)
39 40 SANITIZE_REDIRECTS = setting('SOCIAL_AUTH_SANITIZE_REDIRECTS', True)
  41 +ERROR_MESSAGE = setting('LOGIN_ERROR_MESSAGE', None)
40 42
41 43
42 44 def dsa_view(redirect_name=None):
@@ -170,6 +172,8 @@ def complete_process(request, backend, *args, **kwargs):
170 172 request.session.pop(REDIRECT_FIELD_NAME, '') or \
171 173 DEFAULT_REDIRECT
172 174 else:
  175 + if ERROR_MESSAGE:
  176 + messages.error(request, ERROR_MESSAGE)
173 177 url = LOGIN_ERROR_URL
174 178 return HttpResponseRedirect(url)
175 179

0 comments on commit 826e9a7

Please sign in to comment.
Something went wrong with that request. Please try again.