Hello, In the past hour, I did some research on authenticating by email and I believe Django users would benefit a lot if email authentication was included in contrib.auth .
Many people have been working on it, and the latest code I could find is here: https://gist.github.com/586056. I am not a very good Googler, so there may be better patches. Anyway, there are several problems to solve besides this: 1. the default AuthenticationForm does not accept usernames longer than 30 characters 2. UserCreationForm and possibly the UserChangeForm need to have Email counterparts or become more flexible 3. User emails should be unique. My first thought is to add a unique constraint depending on an optional AUTHENTICATE_BY_EMAIL setting which defaults to False. I find this problem the hardest to solve. I am really open to any suggestions, so please do. Luke Plant, Julien Phalip, I know you have looked into this before and I am really hoping you can share your thoughts as well. ---- https://gist.github.com/586056: from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import User class EmailBackend(ModelBackend): def authenticate(self, **credentials): if 'username' in credentials: return super(EmailBackend, self).authenticate(**credentials) try: user = User.objects.get(email=credentials.get('email')) if user.check_password(credentials.get('password')): return user except User.DoesNotExist: return None -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.