Home > Net >  Cannot login to django admin panel after changing password
Cannot login to django admin panel after changing password

Time:08-16

I have a superuser in django admin and the problem is that when this superuser changes his password, he will be redirected to the django admin login page and when the superuser enters correct username and password in the admin login page, it gives an error that is “Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive.”, but I am sure that both of the username and password fields are filled correctly.

CodePudding user response:

You may be setting the password incorrectly.

If you're storing a plain text password directly, while Django expects a hashed password, the authentication backend won't be able to match the password typed in the form to the one stored in the DB.

Make sure you are setting the password with the set_password method as in user.set_password("PASSWORD"). Check Changing passwords

  • Related