summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/user/user.go6
-rw-r--r--routers/web/org/setting.go2
2 files changed, 1 insertions, 7 deletions
diff --git a/models/user/user.go b/models/user/user.go
index 62f2aa472d..80ddcdba37 100644
--- a/models/user/user.go
+++ b/models/user/user.go
@@ -10,7 +10,6 @@ import (
"crypto/sha256"
"crypto/subtle"
"encoding/hex"
- "errors"
"fmt"
"net/url"
"os"
@@ -73,11 +72,6 @@ const (
EmailNotificationsDisabled = "disabled"
)
-var (
- // ErrUserNameIllegal user name contains illegal characters error
- ErrUserNameIllegal = errors.New("User name contains illegal characters")
-)
-
// User represents the object of individual and member of organization.
type User struct {
ID int64 `xorm:"pk autoincr"`
diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go
index 0a328dfa4e..6c7f9ed62b 100644
--- a/routers/web/org/setting.go
+++ b/routers/web/org/setting.go
@@ -73,7 +73,7 @@ func SettingsPost(ctx *context.Context) {
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSettingsOptions, &form)
return
} else if err = user_model.ChangeUserName(org.AsUser(), form.Name); err != nil {
- if err == user_model.ErrUserNameIllegal {
+ if db.IsErrNameReserved(err) || db.IsErrNamePatternNotAllowed(err) {
ctx.Data["OrgName"] = true
ctx.RenderWithErr(ctx.Tr("form.illegal_username"), tplSettingsOptions, &form)
} else {