-
Website
http://www.davidcramer.net/ -
Original page
http://www.davidcramer.net/code/224/logging-in-with-email-addresses-in-django.html -
Subscribe
All Comments -
Community
-
Top Commenters
-
Rob Hudson
1 comment · 3 points
-
creeva
3 comments · 1 points
-
David Cramer
93 comments · 1 points
-
MsUnderestimated
1 comment · 14 points
-
Matt B.
1 comment · 2 points
-
-
Popular Threads
thanks for posting it, again!
One quirk arises when logging in with an email address in the admin site: if the authentication does not success for any reason you'll get a "Usernames cannot contain the '@' character." error message which is misleading because Django is having no problem to log you in using an email address at this point.
So to correct that you should override the login() method of the admin object as pointed out by James Bennet in this bug:
http://code.djangoproject.com/ticket/8342
Antonio,
Lima - Peru
The code is here at PasteThat:
http://www.pastethat.com/django_email_login
Regards,
Antonio
The reason it doesn't inherit from ModelBackend is that this allows you to specify a second backend to use for permissions.
http://code.djangoproject.com/ticket/8274
Cheers,
Julien Phalip
Could you expand on this? I've been using an EmailBackend similar to yours, except that it inherits from ModelBackend, overrides only the authenticate() method, and I use it all by itself in AUTHENTICATION_BACKENDS. This seems to work just fine. What am I missing that your approach provides?