mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: 优化用户名校验逻辑
--story=1016296 --user=王孝刚 【系统管理】用户创建限制太过于严格,与某些用户/企业的习惯或要求不符合 https://www.tapd.cn/57709429/s/1579177
This commit is contained in:
parent
a873719a49
commit
0b64e7a56c
|
|
@ -40,8 +40,6 @@ class OpenAIChatModel(MaxKBBaseModel, ChatOpenAI):
|
|||
openai_api_base=model_credential.get('api_base'),
|
||||
openai_api_key=model_credential.get('api_key'),
|
||||
**optional_params,
|
||||
streaming=True,
|
||||
stream_usage=True,
|
||||
custom_get_token_ids=custom_get_token_ids
|
||||
)
|
||||
return azure_chat_open_ai
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ class RegisterSerializer(ApiMixin, serializers.Serializer):
|
|||
max_length=20,
|
||||
min_length=6,
|
||||
validators=[
|
||||
validators.RegexValidator(regex=re.compile("^[a-zA-Z][a-zA-Z0-9_]{5,20}$"),
|
||||
message="用户名字符数为 6-20 个字符,必须以字母开头,可使用字母、数字、下划线等")
|
||||
validators.RegexValidator(regex=re.compile("^.{6,20}$"),
|
||||
message="用户名字符数为 6-20 个字符")
|
||||
])
|
||||
password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"),
|
||||
validators=[validators.RegexValidator(regex=re.compile(
|
||||
|
|
@ -590,8 +590,8 @@ class UserManageSerializer(serializers.Serializer):
|
|||
max_length=20,
|
||||
min_length=6,
|
||||
validators=[
|
||||
validators.RegexValidator(regex=re.compile("^[a-zA-Z][a-zA-Z0-9_]{5,20}$"),
|
||||
message="用户名字符数为 6-20 个字符,必须以字母开头,可使用字母、数字、下划线等")
|
||||
validators.RegexValidator(regex=re.compile("^.{6,20}$"),
|
||||
message="用户名字符数为 6-20 个字符")
|
||||
])
|
||||
password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"),
|
||||
validators=[validators.RegexValidator(regex=re.compile(
|
||||
|
|
|
|||
Loading…
Reference in New Issue