python - django update view password and ForeignKey -
i use django update/create view , have problems:
- how can update/create password? - can show old password
 
it doesn't save new 1 django hash algorithm password
ignored , user cant log in anymore.
class update(updateview):     model = user     fields = ['username', 'password']   how can update/create foreign key?
is there way custom fields? i.e. show them
radio/checkbox/password?
thx
i can show old password doesn't save new 1 django hash algorithm password ignored , user cant log in anymore.
that's because security, django doesn't store raw passwords, stores hash of raw password, sufficient tell if user entered correct password
to set password use user.set_password()
user = request.user # or user source user.set_password('raw password string')   so instead of changing field directly, change password above store hash (not raw password), , don't bother "showing old password", secure system won't able to
https://docs.djangoproject.com/en/1.8/ref/contrib/auth/#django.contrib.auth.models.user.set_password
Comments
Post a Comment