diff options
author | Unknwon <joe2010xtmf@163.com> | 2014-11-30 18:29:16 -0500 |
---|---|---|
committer | Unknwon <joe2010xtmf@163.com> | 2014-11-30 18:29:16 -0500 |
commit | 533880860069ca95fba44732721fef3434e1ec99 (patch) | |
tree | 31b69d9b64d76295df8beb6ec0966b963f378da4 /routers/admin/users.go | |
parent | 82da024a4df2a626633a49f70dd3a2889b525d15 (diff) | |
download | gitea-533880860069ca95fba44732721fef3434e1ec99.tar.gz gitea-533880860069ca95fba44732721fef3434e1ec99.zip |
fix #676
Diffstat (limited to 'routers/admin/users.go')
-rw-r--r-- | routers/admin/users.go | 12 |
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")) } |