feat: rdp协议username支持输入中文和$

pull/7454/head
halo 2021-12-15 17:03:08 +08:00 committed by Jiangjie.Bai
parent 35a10fdd62
commit 90de229631
2 changed files with 2 additions and 2 deletions

View File

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

View File

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