Search code examples
pythondjangohashpasswords

Store old password hashes in Django, so Users can't reuse the same password


Is there a way to Store old password hashes in Django, so Users can't reuse the same password?

When doing research on this, every time Django creates a password hash, the hash is different, even though the password is the same. For example, this will return two different hashes:

from django.contrib.auth.hashers import make_password
make_password('foo')
make_password('foo')

I can understand the security reason for this. Have anyone tried to do this in Django? To store old passwords in some way, so Users will have to use a new password when their passwords expire, etc...?


Solution

  • use

    make_password("foo",salt="bar")
    

    but storing historic hashes is really really annoying ...