summaryrefslogtreecommitdiffstats
path: root/routers/admin/users.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-11-30 18:29:16 -0500
committerUnknwon <joe2010xtmf@163.com>2014-11-30 18:29:16 -0500
commit533880860069ca95fba44732721fef3434e1ec99 (patch)
tree31b69d9b64d76295df8beb6ec0966b963f378da4 /routers/admin/users.go
parent82da024a4df2a626633a49f70dd3a2889b525d15 (diff)
downloadgitea-533880860069ca95fba44732721fef3434e1ec99.tar.gz
gitea-533880860069ca95fba44732721fef3434e1ec99.zip
fix #676
Diffstat (limited to 'routers/admin/users.go')
-rw-r--r--routers/admin/users.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/routers/admin/users.go b/routers/admin/users.go
index 0a1056f3bd..2bbf13b92d 100644
--- a/routers/admin/users.go
+++ b/routers/admin/users.go
@@ -192,13 +192,19 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
u.IsActive = form.Active
u.IsAdmin = form.Admin
u.AllowGitHook = form.AllowGitHook
+
+ ctx.Data["User"] = u
+
if err := models.UpdateUser(u); err != nil {
- ctx.Handle(500, "UpdateUser", err)
+ if err == models.ErrEmailAlreadyUsed {
+ ctx.Data["Err_Email"] = true
+ ctx.RenderWithErr(ctx.Tr("form.email_been_used"), USER_EDIT, &form)
+ } else {
+ ctx.Handle(500, "UpdateUser", err)
+ }
return
}
log.Trace("Account profile updated by admin(%s): %s", ctx.User.Name, u.Name)
-
- ctx.Data["User"] = u
ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success"))
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
}