fix: 系统用户账号简单4位长度,密码简单6位
This commit is contained in:
@@ -19,7 +19,7 @@ func ValidUsername(username string) bool {
|
||||
if username == "" {
|
||||
return false
|
||||
}
|
||||
pattern := `^[a-zA-Z][a-z0-9A-Z]{5,}`
|
||||
pattern := `^.{4,}$` //`^[a-zA-Z][a-z0-9A-Z]{5,}`
|
||||
match, err := regexp.MatchString(pattern, username)
|
||||
if err != nil {
|
||||
return false
|
||||
|
||||
@@ -186,7 +186,7 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
}
|
||||
if !regular.ValidUsername(body.UserName) {
|
||||
// msg := fmt.Sprintf("新增用户【%s】失败,登录账号用户账号只能包含大写小写字母,数字,且不少于4位", body.UserName)
|
||||
msg := fmt.Sprintf("Add a new user [%s] failed to log in the account user account can only contain upper and lower case letters, numbers, and not less than 4 digits", body.UserName)
|
||||
msg := fmt.Sprintf("Add a new user [%s] failed to log in the account user account not less than 4 digits", body.UserName)
|
||||
c.JSON(400, resp.ErrMsg(msg))
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user