django中的密码验证返回false

时间:2017-12-16 01:04:32

标签: python django

Jwt坏了,试图手动完成,但它一直返回假

In [2]: me = User.objects.all()[1]

In [3]: me.password
Out[3]: 'password'

In [4]: me.username
Out[4]: 'cchilders'

In [5]: me.email
Out[5]: 'cchilders'

In [9]: me.check_password('password')
Out[9]: False

1 个答案:

答案 0 :(得分:1)

密码应该经过哈希处理,请调用set_password

me.set_password(‘password’)
me.check_password(‘password’)