[Django]-Django check_password() always returning False

4👍

Django does not store the raw hashes, they are prefixed with the algorithm (see documentation).

Without the prefix, Django will be unable to identify the correct hasher. If you look at the source of check_password, you will see that it returns False if it fails to identify a password hashers.

The cleanest solution would probably be a custom authentication backend with uses bcrypt.checkpw directly.

0👍

I fixed the issue with:

from django.contrib.auth.hashers import make_password
password = make_password('yourpassword')

check_password

and

has_usable_password

returns proper values now

0👍

This problem can be solved by installing bcrypt package using "pip install bcrypt" cmd

Leave a comment