diff options
-rw-r--r-- | askbot/deps/django_authopenid/backends.py | 16 | ||||
-rw-r--r-- | askbot/skins/default/templates/authopenid/signin.html | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/askbot/deps/django_authopenid/backends.py b/askbot/deps/django_authopenid/backends.py index e608086c..18e42586 100644 --- a/askbot/deps/django_authopenid/backends.py +++ b/askbot/deps/django_authopenid/backends.py @@ -3,6 +3,7 @@ multiple login methods supported by the authenticator application """ import datetime +import logging from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured from django.utils.translation import ugettext as _ @@ -48,7 +49,20 @@ class AuthBackend(object): if not user.check_password(password): return None except User.DoesNotExist: - return None + try: + email_address = username + user = User.objects.get(email = email_address) + if not user.check_password(password): + return None + except User.DoesNotExist: + return None + except User.MultipleObjectsReturned: + logging.critical( + ('have more than one user with email %s ' + + 'he/she will not be able to authenticate with ' + + 'the email addres in the place of user name') % email_address + ) + return None else: if login_providers[provider_name]['check_password'](username, password): try: diff --git a/askbot/skins/default/templates/authopenid/signin.html b/askbot/skins/default/templates/authopenid/signin.html index 37636207..49c447a1 100644 --- a/askbot/skins/default/templates/authopenid/signin.html +++ b/askbot/skins/default/templates/authopenid/signin.html @@ -94,7 +94,7 @@ {% endif %}
<table class="login">
<tr>
- <td><label for="id_username">{% trans %}Login name{% endtrans %}</label></td>
+ <td><label for="id_username">{% trans %}Login or email{% endtrans %}</label></td>
<td>{{login_form.username}}</td>
</tr>
<tr>
|