perf: 优化创建账号密码校验逻辑 (#12383)

Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
fit2bot
2023-12-20 16:35:36 +08:00
committed by GitHub
parent c66b1db784
commit 533f13c634
6 changed files with 223 additions and 202 deletions

View File

@@ -47,7 +47,10 @@ class SecretGenerator:
def validate_password_for_ansible(password):
""" 校验 Ansible 不支持的特殊字符 """
pass
if password.startswith('{{') and password.endswith('}}'):
raise serializers.ValidationError(
_('If the password starts with {{` and ends with }} `, then the password is not allowed.')
)
def validate_ssh_key(ssh_key, passphrase=None):