diff --git a/models/user.go b/models/user.go index 9a15de082..37876063e 100644 --- a/models/user.go +++ b/models/user.go @@ -77,9 +77,6 @@ var ( // ErrEmailNotActivated e-mail address has not been activated error ErrEmailNotActivated = errors.New("E-mail address has not been activated") - // ErrUserNameIllegal user name contains illegal characters error - ErrUserNameIllegal = errors.New("User name contains illegal characters") - // ErrLoginSourceNotActived login source is not actived error ErrLoginSourceNotActived = errors.New("Login source is not actived") diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 3414bb8dd..999a9b356 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -65,7 +65,7 @@ func SettingsPost(ctx *context.Context) { ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSettingsOptions, &form) return } else if err = models.ChangeUserName(org, form.Name); err != nil { - if err == models.ErrUserNameIllegal { + if models.IsErrNameReserved(err) || models.IsErrNamePatternNotAllowed(err) { ctx.Data["OrgName"] = true ctx.RenderWithErr(ctx.Tr("form.illegal_username"), tplSettingsOptions, &form) } else {