Based on Nico Williams' case-sensitive email problem, make sure

that usernames and emails are compared ignoring case when logging
in.
 - Legacy-Id: 925
This commit is contained in:
Bill Fenner 2007-09-06 15:12:33 +00:00
parent 6cd7612f2c
commit b6301e4660
2 changed files with 3 additions and 3 deletions

View file

@ -94,7 +94,7 @@ while line != '':
t = user
if add:
t += "%d" % ( add )
u = User.objects.get(username = t)
u = User.objects.get(username__iexact = t)
except User.DoesNotExist:
u = None
user = t

View file

@ -27,9 +27,9 @@ class EmailBackend(ModelBackend):
def authenticate(self, username=None, password=None):
try:
if email_re.search(username):
user = User.objects.get(email=username)
user = User.objects.get(email__iexact=username)
else:
user = User.objects.get(username=username)
user = User.objects.get(username__iexact=username)
except User.DoesNotExist:
return None
if crypt_check_password(user, password):