• Home
  • Jobs
  • Courses
  • Questions
  • Teachers
  • For business
  • ES/EN

0

54
Views
Django fails user authentication

Check user password fails after save

Django 1.11 postgres (postgis)

password hashes defined in settings.py

PASSWORD_HASHERS = [
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
    'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
    'django.contrib.auth.hashers.Argon2PasswordHasher',
    'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
    'django.contrib.auth.hashers.BCryptPasswordHasher', ]

What I trying to do:

> ./manage shell
    In [1]: from accounts.models import User

In [2]: u = User.objects.get(pk=1)

In [3]: u.password
Out[3]: 'pbkdf2_sha256$36000$LlYFKXzibqZP$t7njfFLddkUos0ePjMTlSqM2KVhduFVvXTEobiHbXng=                                                   '

In [4]: u.check_password('123456')
Out[4]: False

In [5]: u.refresh_from_db()

In [6]: u.set_password('123456')

In [7]: u.password
Out[7]: 'pbkdf2_sha256$36000$WwQpAA6KyVX8$2GMy23BV1go4h/f/nlBezA50Jsc7QOi2sBlZsYhPAYM='

In [8]: u.check_password('123456')
Out[8]: True

In [9]: u.refresh_from_db()

In [10]: u.password
Out[10]: 'pbkdf2_sha256$36000$LlYFKXzibqZP$t7njfFLddkUos0ePjMTlSqM2KVhduFVvXTEobiHbXng=                                                   '

In [11]: u.check_password('123456')
Out[11]: False

Update: First I thought it because migrate database from mysql to postgres but even for reseting password

3 months ago ·

Santiago Trujillo

Answer question
Find remote jobs
Loading

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2022 PeakU Inc. All Rights Reserved.