Merge pull request #12042 from jumpserver/pr@dev@ansible

perf: 密码中支持特殊字符比如"
pull/12047/head
huailei 2023-11-06 18:19:34 +08:00 committed by GitHub
commit 06275a09ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -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):