Enforce update nickname
Some checks failed
Client CMS Check Build (NixCN CMS) TeamCity build failed
Backend Check Build (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-02-11 21:47:25 +08:00
parent 6a890ab17f
commit 17483d31fe

View File

@@ -39,7 +39,25 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
}
if payload.Data.Nickname != nil {
if utf8.RuneCountInString(*payload.Data.Nickname) > 24 {
val := *payload.Data.Nickname
if val == "" {
execption := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceUser).
SetType(exception.TypeCommon).
SetOriginal(exception.CommonErrorInvalidInput)
result = &UserInfoResult{
Common: shared.CommonResult{
HttpCode: 400,
Exception: execption,
},
Data: nil,
}
return
}
if utf8.RuneCountInString(val) > 24 {
execption := new(exception.Builder).
SetStatus(exception.StatusUser).
SetService(exception.ServiceUser).