I am using Python 3.9.7 and Django 3.2.7.
Issue details
The following code is being used to verify the submitted password.
I can confirm that the submitted password has a valid value and user.password
is a hashed password stored in the database.
passwordCheckResult = check_password(request.POST.get("password"), user.password)
print(passwordCheckResult)
Why does it always return False?
Hashed password: pbkdf2_sha256$260000$Y0LeK0HJ90YPrj5lOijV20$oFRLMk
Plain password: 123
What I searched so far
Django check_password() always returning False but this is not fixing my issue.
The below code works but not the above one.
hashed = make_password("123")
check_password("123", hashed) # This returns True
Model
class tblusers(models.Model):
user_id = BigAutoField(primary_key=True)
password = CharField(max_length=50, null=False)
created_at = DateTimeField(auto_now_add=True, blank=True)