For the record and as an answer to the previous question, I'd like to quote Russell who wrote the following in reponse to a ticket of mine:
" The core-endorsed ticket for this problem is #3011. The patch on that ticket isn't endorsed, but it points at the real problem - a need to be able to specify a custom User model. There have been several discussions directed at this problem, and I'm hoping to get a posse discussing this at the upcoming DjangoCon sprints. If you want background on some approaches that might work (and some that won't) search the archives for Lazy Foreign Key. " Thanks Russell and I wish you good luck in the Django sprints! - Wim On Aug 26, 5:23 pm, Wim Feijen <wimfei...@gmail.com> wrote: > 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.