Fix error order
This commit is contained in:
parent
e868f91f84
commit
6e40ef6f54
|
@ -33,13 +33,9 @@ func HandleUserEdit(sc context.Context) echo.HandlerFunc {
|
||||||
|
|
||||||
if name == "" {
|
if name == "" {
|
||||||
errors.Name = "required"
|
errors.Name = "required"
|
||||||
}
|
} else if len(name) > maxLength {
|
||||||
|
|
||||||
if len(name) > maxLength {
|
|
||||||
errors.Name = fmt.Sprintf("%d characters too long", len(name)-maxLength)
|
errors.Name = fmt.Sprintf("%d characters too long", len(name)-maxLength)
|
||||||
}
|
} else if !regexp.MustCompile(`^[a-zA-Z0-9_-]+$`).MatchString(name) {
|
||||||
|
|
||||||
if !regexp.MustCompile(`^[a-zA-Z0-9_-]+$`).MatchString(name) {
|
|
||||||
errors.Name = "only letters, numbers, _ and - allowed"
|
errors.Name = "only letters, numbers, _ and - allowed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue