From dbc471c1957191d304a66cf370c71513dca31cff Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 8 Jun 2018 18:40:31 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8D=E5=B0=8F=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/ops/inventory.py | 2 +- apps/users/views/user.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/ops/inventory.py b/apps/ops/inventory.py index 230af9dfe..b7d3ef487 100644 --- a/apps/ops/inventory.py +++ b/apps/ops/inventory.py @@ -98,7 +98,7 @@ class JMSInventory(BaseInventory): if gateway.private_key: proxy_command_list.append("-i {}".format(gateway.private_key_file)) - proxy_command = "'-o ProxyCommand={}".format( + proxy_command = "'-o ProxyCommand={}'".format( " ".join(proxy_command_list) ) return {"ansible_ssh_common_args": proxy_command} diff --git a/apps/users/views/user.py b/apps/users/views/user.py index 3adb1d156..094d2ced2 100644 --- a/apps/users/views/user.py +++ b/apps/users/views/user.py @@ -109,14 +109,15 @@ class UserUpdateView(AdminUserRequiredMixin, SuccessMessageMixin, UpdateView): def form_valid(self, form): password = form.cleaned_data.get('password') - 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) + if not password: + return super().form_valid(form) + 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)