You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2025/04/18 03:53:00 UTC
(answer) branch dev updated: fix: Username minimum length still set to 4
This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/dev by this push:
new 59f0c3fb fix: Username minimum length still set to 4
59f0c3fb is described below
commit 59f0c3fb63ae59280f4fdea0cb2a9e5639975d80
Author: sy-records <52...@qq52o.cn>
AuthorDate: Fri Apr 18 10:49:04 2025 +0800
fix: Username minimum length still set to 4
---
docs/docs.go | 3 ++-
docs/swagger.json | 3 ++-
docs/swagger.yaml | 1 +
internal/schema/user_schema.go | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/docs/docs.go b/docs/docs.go
index 9ae127b6..c9a1ff3b 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -11050,7 +11050,8 @@ const docTemplate = `{
},
"username": {
"type": "string",
- "maxLength": 30
+ "maxLength": 30,
+ "minLength": 2
},
"website": {
"type": "string",
diff --git a/docs/swagger.json b/docs/swagger.json
index 3ad5156b..6a22fa9d 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -11023,7 +11023,8 @@
},
"username": {
"type": "string",
- "maxLength": 30
+ "maxLength": 30,
+ "minLength": 2
},
"website": {
"type": "string",
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index a521169c..902303a5 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -2489,6 +2489,7 @@ definitions:
type: string
username:
maxLength: 30
+ minLength: 2
type: string
website:
maxLength: 500
diff --git a/internal/schema/user_schema.go b/internal/schema/user_schema.go
index 9d126da8..3abbbdb3 100644
--- a/internal/schema/user_schema.go
+++ b/internal/schema/user_schema.go
@@ -239,7 +239,7 @@ func (u *UserModifyPasswordReq) Check() (errFields []*validator.FormErrorField,
type UpdateInfoRequest struct {
DisplayName string `validate:"omitempty,gt=0,lte=30" json:"display_name"`
- Username string `validate:"omitempty,gt=3,lte=30" json:"username"`
+ Username string `validate:"omitempty,gte=2,lte=30" json:"username"`
Avatar AvatarInfo `json:"avatar"`
Bio string `validate:"omitempty,gt=0,lte=4096" json:"bio"`
BioHTML string `json:"-"`