update backend/dvadmin/system/views/user.py.
在创建用户时, 设置非默认密码,修改密码时提示密码错误,创建用户时调用了多次md5进行存储 Signed-off-by: lxy <46486798@qq.com>
This commit is contained in:
@@ -330,6 +330,10 @@ class UserViewSet(CustomModelViewSet):
|
|||||||
if not verify_password:
|
if not verify_password:
|
||||||
old_pwd_md5 = hashlib.md5(old_pwd.encode(encoding='UTF-8')).hexdigest()
|
old_pwd_md5 = hashlib.md5(old_pwd.encode(encoding='UTF-8')).hexdigest()
|
||||||
verify_password = check_password(str(old_pwd_md5), request.user.password)
|
verify_password = check_password(str(old_pwd_md5), request.user.password)
|
||||||
|
# 创建用户时、自定义密码无法修改问题
|
||||||
|
if not verify_password:
|
||||||
|
old_pwd_md5 = hashlib.md5(old_pwd_md5.encode(encoding='UTF-8')).hexdigest()
|
||||||
|
verify_password = check_password(str(old_pwd_md5), request.user.password)
|
||||||
if verify_password:
|
if verify_password:
|
||||||
request.user.password = make_password(hashlib.md5(new_pwd.encode(encoding='UTF-8')).hexdigest())
|
request.user.password = make_password(hashlib.md5(new_pwd.encode(encoding='UTF-8')).hexdigest())
|
||||||
request.user.save()
|
request.user.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user