Sunday, July 24, 2016

Re: Cannot login with user credentials


> I can save and create a new user. Also I can see the hashed password in the admin. However when I try to login with the `email` and `password` of the new user, I am not being authenticated. To check if I am actually getting any password, I tried printing the self.cleaned_data["password"] in the UserCreationForm, and in the console I can see the password I gave. What am I doing wrong here? Please help me.
>
>

If you're only using the default authentication back-end, did you set AUTH_USER_MODEL accordingly?

https://docs.djangoproject.com/en/1.9/topics/auth/customizing/#substituting-a-custom-user-model

I see you've set USERNAME_FIELD to 'email', but since you've mentioned you can log in using a super user (and I presume a user name and not an email address), I suspect you are missing the AUTH_USER_MODEL setting.

Are you using a custom authentication back-end that can handle looking for an email address as a username? If you want logins via both a user name and email address to work, you'll need to implement that with a custom back-end.

https://docs.djangoproject.com/en/1.9/topics/auth/customizing/#writing-an-authentication-backend

-James

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXQ1du2VRyHXyf31crSRhjBDGfowdkYLYyc03wu37_ppA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment