summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-05 11:14:17 +0800
committerUnknwon <u@gogs.io>2015-08-05 11:14:17 +0800
commite50982f5ec78c3cfa4a1cf322f7fa1a4dea44b84 (patch)
treef6dffcf1c5a273a077a8b33c75334b9994ca02ff /routers/user
parent487fc8ca39a3de565fc6c67aea72c4658bbf64c8 (diff)
downloadgitea-e50982f5ec78c3cfa4a1cf322f7fa1a4dea44b84.tar.gz
gitea-e50982f5ec78c3cfa4a1cf322f7fa1a4dea44b84.zip
allow anonymous SSH clone
Diffstat (limited to 'routers/user')
-rw-r--r--routers/user/auth.go8
-rw-r--r--routers/user/home.go14
2 files changed, 11 insertions, 11 deletions
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 52675a777d..4b29a29ec8 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -60,7 +60,7 @@ func SignIn(ctx *middleware.Context) {
u, err := models.GetUserByName(uname)
if err != nil {
- if err != models.ErrUserNotExist {
+ if !models.IsErrUserNotExist(err) {
ctx.Handle(500, "GetUserByName", err)
} else {
ctx.HTML(200, SIGNIN)
@@ -105,7 +105,7 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) {
u, err := models.UserSignIn(form.UserName, form.Password)
if err != nil {
- if err == models.ErrUserNotExist {
+ if models.IsErrUserNotExist(err) {
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), SIGNIN, &form)
} else {
ctx.Handle(500, "UserSignIn", err)
@@ -328,7 +328,7 @@ func Activate(ctx *middleware.Context) {
user.IsActive = true
user.Rands = models.GetUserSalt()
if err := models.UpdateUser(user); err != nil {
- if err == models.ErrUserNotExist {
+ if models.IsErrUserNotExist(err) {
ctx.Error(404)
} else {
ctx.Handle(500, "UpdateUser", err)
@@ -391,7 +391,7 @@ func ForgotPasswdPost(ctx *middleware.Context) {
email := ctx.Query("email")
u, err := models.GetUserByEmail(email)
if err != nil {
- if err == models.ErrUserNotExist {
+ if models.IsErrUserNotExist(err) {
ctx.Data["Err_Email"] = true
ctx.RenderWithErr(ctx.Tr("auth.email_not_associate"), FORGOT_PASSWORD, nil)
} else {
diff --git a/routers/user/home.go b/routers/user/home.go
index 503f9e3667..5e77b837f8 100644
--- a/routers/user/home.go
+++ b/routers/user/home.go
@@ -38,7 +38,7 @@ func Dashboard(ctx *middleware.Context) {
// Organization.
org, err := models.GetUserByName(orgName)
if err != nil {
- if err == models.ErrUserNotExist {
+ if models.IsErrUserNotExist(err) {
ctx.Handle(404, "GetUserByName", err)
} else {
ctx.Handle(500, "GetUserByName", err)
@@ -115,7 +115,7 @@ func Dashboard(ctx *middleware.Context) {
// FIXME: cache results?
u, err := models.GetUserByName(act.ActUserName)
if err != nil {
- if err == models.ErrUserNotExist {
+ if models.IsErrUserNotExist(err) {
continue
}
ctx.Handle(500, "GetUserByName", err)
@@ -176,7 +176,7 @@ func Profile(ctx *middleware.Context) {
u, err := models.GetUserByName(uname)
if err != nil {
- if err == models.ErrUserNotExist {
+ if models.IsErrUserNotExist(err) {
ctx.Handle(404, "GetUserByName", err)
} else {
ctx.Handle(500, "GetUserByName", err)
@@ -223,7 +223,7 @@ func Profile(ctx *middleware.Context) {
// FIXME: cache results?
u, err := models.GetUserByName(act.ActUserName)
if err != nil {
- if err == models.ErrUserNotExist {
+ if models.IsErrUserNotExist(err) {
continue
}
ctx.Handle(500, "GetUserByName", err)
@@ -247,10 +247,10 @@ func Profile(ctx *middleware.Context) {
func Email2User(ctx *middleware.Context) {
u, err := models.GetUserByEmail(ctx.Query("email"))
if err != nil {
- if err == models.ErrUserNotExist {
- ctx.Handle(404, "user.Email2User(GetUserByEmail)", err)
+ if models.IsErrUserNotExist(err) {
+ ctx.Handle(404, "GetUserByEmail", err)
} else {
- ctx.Handle(500, "user.Email2User(GetUserByEmail)", err)
+ ctx.Handle(500, "GetUserByEmail", err)
}
return
}