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