From 90de22963172a2337ce656edeebac37152b16e6a Mon Sep 17 00:00:00 2001 From: halo Date: Wed, 15 Dec 2021 17:03:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20rdp=E5=8D=8F=E8=AE=AEusername=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=BE=93=E5=85=A5=E4=B8=AD=E6=96=87=E5=92=8C$?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/serializers/system_user.py | 2 +- apps/common/validators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/assets/serializers/system_user.py b/apps/assets/serializers/system_user.py index 62ab54683..0f08b347f 100644 --- a/apps/assets/serializers/system_user.py +++ b/apps/assets/serializers/system_user.py @@ -108,7 +108,7 @@ class SystemUserSerializer(AuthSerializerMixin, BulkOrgResourceModelSerializer): protocol = self.get_initial_value("protocol") if username: regx = alphanumeric_re - if protocol == SystemUser.Protocol.telnet: + if protocol == SystemUser.Protocol.telnet or protocol == SystemUser.Protocol.rdp: regx = alphanumeric_cn_re if not regx.match(username): raise serializers.ValidationError(_('Special char not allowed')) diff --git a/apps/common/validators.py b/apps/common/validators.py index 8e7e504ed..0c81b1e4e 100644 --- a/apps/common/validators.py +++ b/apps/common/validators.py @@ -15,7 +15,7 @@ alphanumeric = RegexValidator(r'^[0-9a-zA-Z_@\-\.]*$', _('Special char not allow alphanumeric_re = re.compile(r'^[0-9a-zA-Z_@\-\.]*$') -alphanumeric_cn_re = re.compile(r'^[0-9a-zA-Z_@\-\.\u4E00-\u9FA5]*$') +alphanumeric_cn_re = re.compile(r'^[0-9a-zA-Z_@\$\-\.\u4E00-\u9FA5]*$') class ProjectUniqueValidator(UniqueTogetherValidator):