aboutsummaryrefslogtreecommitdiff
path: root/internal/route/user/auth.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-04-17 10:14:18 +0800
committerGitHub <noreply@github.com>2020-04-17 10:14:18 +0800
commitfa497b16332c24bc4d9e788c64bda94e3c1499a7 (patch)
tree1dcf1b13f702a07dc30da791bf0e76e1ffba4027 /internal/route/user/auth.go
parente131a4564680a3257a2d4795af7669e4260b33b9 (diff)
db: add tests for repos (#6112)
* Add Repos.create method * Fix repo name error handling * Fix all compile errors * Update github.com/go-macaron/captcha to fix http issue * Add repos tests
Diffstat (limited to 'internal/route/user/auth.go')
-rw-r--r--internal/route/user/auth.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/internal/route/user/auth.go b/internal/route/user/auth.go
index 852c9679..cadc083a 100644
--- a/internal/route/user/auth.go
+++ b/internal/route/user/auth.go
@@ -344,12 +344,9 @@ func SignUpPost(c *context.Context, cpt *captcha.Captcha, f form.Register) {
case db.IsErrEmailAlreadyUsed(err):
c.FormErr("Email")
c.RenderWithErr(c.Tr("form.email_been_used"), SIGNUP, &f)
- case db.IsErrNameReserved(err):
+ case db.IsErrNameNotAllowed(err):
c.FormErr("UserName")
- c.RenderWithErr(c.Tr("user.form.name_reserved", err.(db.ErrNameReserved).Name), SIGNUP, &f)
- case db.IsErrNamePatternNotAllowed(err):
- c.FormErr("UserName")
- c.RenderWithErr(c.Tr("user.form.name_pattern_not_allowed", err.(db.ErrNamePatternNotAllowed).Pattern), SIGNUP, &f)
+ c.RenderWithErr(c.Tr("user.form.name_not_allowed", err.(db.ErrNameNotAllowed).Value()), SIGNUP, &f)
default:
c.Error(err, "create user")
}