PASSWORD_HASHERS setting in Django

前端 未结 2 781
既然无缘
既然无缘 2020-12-19 00:50

i have an error when ever i try to login by any User error

Unknown password hashing algorithm \'sahar\'. Did you specify it in the PASSWORD_HASHERS

2条回答
  •  醉梦人生
    2020-12-19 01:04

    It means there is a plain text 'sahar' stored as the password of the account of a user who tries to log in.
    Update the password of the user in Admin or in manage.py shell

    user = User.objects.get(username=username)
    
    # use set_password method
    user.set_password('sahar')
    user.save()
    
    # INSTEAD OF 
    user.password = 'sahar'
    user.save()
    

    Also check your other views to correct the user.password = '...' and User.objects.create(password='...') usages.

提交回复
热议问题