From 3e614b83a89429c55049f1f751d68add628e2cfc Mon Sep 17 00:00:00 2001 From: yp05327 <576951401@qq.com> Date: Thu, 30 Mar 2023 02:34:55 +0000 Subject: [PATCH] fix --- routers/web/admin/users.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/routers/web/admin/users.go b/routers/web/admin/users.go index 1bb9d0480682e..936c37b5832da 100644 --- a/routers/web/admin/users.go +++ b/routers/web/admin/users.go @@ -314,13 +314,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 } @@ -336,7 +336,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