From e106324c7003792ca667af97f3cdc7efdd520115 Mon Sep 17 00:00:00 2001 From: lxy <46486798@qq.com> Date: Thu, 25 Jul 2024 00:33:24 +0000 Subject: [PATCH] =?UTF-8?q?update=20backend/dvadmin/system/views/user.py.?= =?UTF-8?q?=20=E5=9C=A8=E5=88=9B=E5=BB=BA=E7=94=A8=E6=88=B7=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=20=E8=AE=BE=E7=BD=AE=E9=9D=9E=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=AF=86=E7=A0=81=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E6=97=B6=E6=8F=90=E7=A4=BA=E5=AF=86=E7=A0=81=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=88=9B=E5=BB=BA=E7=94=A8=E6=88=B7=E6=97=B6=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E4=BA=86=E5=A4=9A=E6=AC=A1md5=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lxy <46486798@qq.com> --- backend/dvadmin/system/views/user.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/dvadmin/system/views/user.py b/backend/dvadmin/system/views/user.py index 116d71f..68de06b 100644 --- a/backend/dvadmin/system/views/user.py +++ b/backend/dvadmin/system/views/user.py @@ -330,6 +330,10 @@ class UserViewSet(CustomModelViewSet): if not verify_password: old_pwd_md5 = hashlib.md5(old_pwd.encode(encoding='UTF-8')).hexdigest() 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: request.user.password = make_password(hashlib.md5(new_pwd.encode(encoding='UTF-8')).hexdigest()) request.user.save()