Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: Username minimum length still set to 4

sy-records59f0c3fb63ae
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:"-"`