From 6839eb408b0d10bd8ea359bfaa2b76c01639c80c Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 20 Jun 2022 23:24:21 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=BC=96=E8=BE=91=E6=97=A0=E6=B3=95=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/account/views.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spug_api/apps/account/views.py b/spug_api/apps/account/views.py index b5542bc..085ed73 100644 --- a/spug_api/apps/account/views.py +++ b/spug_api/apps/account/views.py @@ -41,13 +41,12 @@ class UserView(AdminView): return json_response(error=f'已存在登录名为【{form.username}】的用户') role_ids, password = form.pop('role_ids'), form.pop('password') - if not verify_password(password): - return json_response(error='请设置至少8位包含数字、小写和大写字母的新密码') - if form.id: user = User.objects.get(pk=form.id) user.update_by_dict(form) else: + if not verify_password(password): + return json_response(error='请设置至少8位包含数字、小写和大写字母的新密码') user = User.objects.create( password_hash=User.make_password(password), created_by=request.user,