Skip to content Skip to sidebar Skip to footer

Authenticate Returns Nothing

what im experimenting is the next: S:\proj>manage.py shell Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) django 1.1.1 >>> from django.contrib.auth.models import Use

Solution 1:

The problem is not with authenticate, but with your creation of the user.

The value stored in u.password needs to be the hashed value of the password, not the raw password itself.

You can use u.set_password('password') to take care of the hashing for you:

>>>u = User(name='luis')>>>u.set_password('password')>>>u.save()>>>authenticate(username='luis', password='password')
<User: luis>

Post a Comment for "Authenticate Returns Nothing"