From 7b86938b5868553a483fced56e13a314ce776377 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Fri, 3 Nov 2023 15:20:19 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=AF=86=E7=A0=81=E4=B8=AD=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E6=AF=94=E5=A6=82?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/accounts/utils.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/accounts/utils.py b/apps/accounts/utils.py index ac896f8c0..229cb0111 100644 --- a/apps/accounts/utils.py +++ b/apps/accounts/utils.py @@ -49,15 +49,15 @@ def validate_password_for_ansible(password): # validate password contains left double curly bracket # check password not contains `{{` # Ansible 推送的时候不支持 - if '{{' in password: - raise serializers.ValidationError(_('Password can not contains `{{` ')) - if '{%' in password: - raise serializers.ValidationError(_('Password can not contains `{%` ')) + if '{{' in password or '}}' in password: + raise serializers.ValidationError(_('Password can not contains `{{` or `}}`')) + if '{%' in password or '%}' in password: + raise serializers.ValidationError(_('Password can not contains `{%` or `%}`')) # Ansible Windows 推送的时候不支持 - if "'" in password: - raise serializers.ValidationError(_("Password can not contains `'` ")) - if '"' in password: - raise serializers.ValidationError(_('Password can not contains `"` ')) + # if "'" in password: + # raise serializers.ValidationError(_("Password can not contains `'` ")) + # if '"' in password: + # raise serializers.ValidationError(_('Password can not contains `"` ')) def validate_ssh_key(ssh_key, passphrase=None):