From f4084c800abf25c440a8663801b842d788409b0b Mon Sep 17 00:00:00 2001 From: xiaodong Date: Fri, 8 Jun 2018 16:15:26 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=B6=E4=B8=8D=E5=A1=AB=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E4=B9=9F=E4=BC=9A=E8=A7=A6=E5=8F=91=E5=AF=86=E7=A0=81=E8=A7=84?= =?UTF-8?q?=E5=88=99=E9=AA=8C=E8=AF=81,=E5=AF=BC=E8=87=B4=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/views/user.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/users/views/user.py b/apps/users/views/user.py index 598726fc1..3adb1d156 100644 --- a/apps/users/views/user.py +++ b/apps/users/views/user.py @@ -109,12 +109,13 @@ class UserUpdateView(AdminUserRequiredMixin, SuccessMessageMixin, UpdateView): def form_valid(self, form): password = form.cleaned_data.get('password') - is_ok = check_password_rules(password) - if not is_ok: - form.add_error( - "password", _("* Your password does not meet the requirements") - ) - return self.form_invalid(form) + if password: + is_ok = check_password_rules(password) + if not is_ok: + form.add_error( + "password", _("* Your password does not meet the requirements") + ) + return self.form_invalid(form) return super().form_valid(form)