> A custom authentication backend isn't required; the ModelBackend should 
adapt to any well-defined User model.

Thanks Russ, I hadn't realized the ModelBackend tied in nicely with those 
changes.

> Have you tried changing USERNAME_FIELD to 'email'? 

+1, looks like that's the OP's issue.

On Sunday, 16 December 2012 01:12:14 UTC, Quartic wrote:
>
> On 15/12/12 11:18, sebastie...@gmail.com <javascript:> wrote: 
> > Hi, i've an authenticate problem with Django 1.5 
> > All informations are 
> > herehttp://
> stackoverflow.com/questions/13883539/authenticate-with-django-1-5 
> > but i'll resume the situation : 
> > 
> > I've a custum user model which looks like : 
> > 
> > class User(AbstractBaseUser): 
> >      email = models.EmailField(unique=True) 
> >      activation_key = models.CharField(max_length=255) 
> >      is_active = models.BooleanField(default=False) 
> >      is_admin = models.BooleanField(default=False) 
> > 
> >      objects = UserManager() 
> > 
> >      USERNAME_FIELD = 'username' 
> > 
> <snip> 
> > 
> > 
> > The probleme is that user = authenticate(username=email, 
> > password=password) gives me None as return. 
> > According to the doc, authenticate takes an usersname, not an email as 
> > arg. But how can i use authenticate because my User model desn't support 
> > Username. 
> > Is there a solution with Django 1.5 ? 
> > 
>
> Have you tried changing USERNAME_FIELD to 'email'? 
>
> Ian 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/kz4lo-mJWMUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to