summaryrefslogtreecommitdiffstats
path: root/routers/user
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-05 20:26:00 +0800
committerUnknwon <u@gogs.io>2015-08-05 20:26:00 +0800
commit2c507667bfd17f88dc4bfabc426c74cd5f8e4461 (patch)
tree31b267331f84d45a92f6a0bfe7eaafa124f4578f /routers/user
parent0705f55ce097b9892a7c4c11faa5396c4e557232 (diff)
parentb9527cd1bfabcce3be62b43f0c199b1418519549 (diff)
downloadgitea-2c507667bfd17f88dc4bfabc426c74cd5f8e4461.tar.gz
gitea-2c507667bfd17f88dc4bfabc426c74cd5f8e4461.zip
Merge branch 'develop' of github.com:gogits/gogs into feature/milestone
# Conflicts: # gogs.go # models/issue.go # templates/.VERSION
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 257f756174..c38dba5205 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
}