Merge branch 'NyaDoo/master'

This commit is contained in:
fawney19
2026-01-28 00:10:00 +08:00
5 changed files with 55 additions and 9 deletions

View File

@@ -320,8 +320,8 @@ class UpdateUserRequest(BaseModel):
if v is None:
return v
if not re.match(r"^[a-zA-Z0-9_-]+$", v):
raise ValueError("用户名只能包含字母、数字、下划线连字符")
if not re.match(r"^[a-zA-Z0-9_.\-]+$", v):
raise ValueError("用户名只能包含字母、数字、下划线连字符和点号")
return v

View File

@@ -103,8 +103,8 @@ class RegisterRequest(BaseModel):
v = v.strip()
if not v:
raise ValueError("用户名不能为空")
if not re.match(r"^[a-zA-Z0-9_-]+$", v):
raise ValueError("用户名只能包含字母、数字、下划线和短横线")
if not re.match(r"^[a-zA-Z0-9_.\-]+$", v):
raise ValueError("用户名只能包含字母、数字、下划线、连字符和点号")
return v
@classmethod
@@ -279,8 +279,8 @@ class CreateUserRequest(BaseModel):
v = v.strip()
if not v:
raise ValueError("用户名不能为空")
if not re.match(r"^[a-zA-Z0-9_-]+$", v):
raise ValueError("用户名只能包含字母、数字、下划线和短横线")
if not re.match(r"^[a-zA-Z0-9_.\-]+$", v):
raise ValueError("用户名只能包含字母、数字、下划线、连字符和点号")
return v
@classmethod