Skip to content

Commit

Permalink
fix: 创建新用户时用户名含有 0 时校验不通过 1Panel-dev#358 (1Panel-dev#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed May 7, 2024
1 parent 77d71f9 commit 7a08f03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/users/serializers/user_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class RegisterSerializer(ApiMixin, serializers.Serializer):
max_length=20,
min_length=6,
validators=[
validators.RegexValidator(regex=re.compile("^[a-zA-Z][a-zA-Z1-9_]{5,20}$"),
validators.RegexValidator(regex=re.compile("^[a-zA-Z][a-zA-Z0-9_]{5,20}$"),
message="用户名字符数为 6-20 个字符,必须以字母开头,可使用字母、数字、下划线等")
])
password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"),
Expand Down Expand Up @@ -582,7 +582,7 @@ class UserInstance(ApiMixin, serializers.Serializer):
max_length=20,
min_length=6,
validators=[
validators.RegexValidator(regex=re.compile("^[a-zA-Z][a-zA-Z1-9_]{5,20}$"),
validators.RegexValidator(regex=re.compile("^[a-zA-Z][a-zA-Z0-9_]{5,20}$"),
message="用户名字符数为 6-20 个字符,必须以字母开头,可使用字母、数字、下划线等")
])
password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"),
Expand Down

0 comments on commit 7a08f03

Please sign in to comment.