diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index 5fb2a3e5d..531f14d08 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -316,13 +316,13 @@ func EditUserPost(ctx *context.Context) { log.Error(err.Error()) errMsg = ctx.Tr("auth.password_pwned_err") } - ctx.RenderWithErr(errMsg, tplUserNew, &form) + ctx.RenderWithErr(errMsg, tplUserEdit, &form) return } if err := user_model.ValidateEmail(form.Email); err != nil { ctx.Data["Err_Email"] = true - ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserNew, &form) + ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserEdit, &form) return } @@ -338,7 +338,10 @@ func EditUserPost(ctx *context.Context) { if len(form.UserName) != 0 && u.Name != form.UserName { if err := user_setting.HandleUsernameChange(ctx, u, form.UserName); err != nil { - ctx.Redirect(setting.AppSubURL + "/admin/users") + if ctx.Written() { + return + } + ctx.RenderWithErr(ctx.Flash.ErrorMsg, tplUserEdit, &form) return } u.Name = form.UserName