Skip to content

Commit aa1584f

Browse files
committed
fix
1 parent 02f156e commit aa1584f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

routers/web/admin/users.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ func EditUserPost(ctx *context.Context) {
275275
ctx.Data["PageIsAdmin"] = true
276276
ctx.Data["PageIsAdminUsers"] = true
277277
ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations
278+
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
278279

279280
u := prepareUserInfo(ctx)
280281
if ctx.Written() {
@@ -316,13 +317,13 @@ func EditUserPost(ctx *context.Context) {
316317
log.Error(err.Error())
317318
errMsg = ctx.Tr("auth.password_pwned_err")
318319
}
319-
ctx.RenderWithErr(errMsg, tplUserNew, &form)
320+
ctx.RenderWithErr(errMsg, tplUserEdit, &form)
320321
return
321322
}
322323

323324
if err := user_model.ValidateEmail(form.Email); err != nil {
324325
ctx.Data["Err_Email"] = true
325-
ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserNew, &form)
326+
ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserEdit, &form)
326327
return
327328
}
328329

@@ -338,7 +339,10 @@ func EditUserPost(ctx *context.Context) {
338339

339340
if len(form.UserName) != 0 && u.Name != form.UserName {
340341
if err := user_setting.HandleUsernameChange(ctx, u, form.UserName); err != nil {
341-
ctx.Redirect(setting.AppSubURL + "/admin/users")
342+
if ctx.Written() {
343+
return
344+
}
345+
ctx.RenderWithErr(ctx.Flash.ErrorMsg, tplUserEdit, &form)
342346
return
343347
}
344348
u.Name = form.UserName

0 commit comments

Comments
 (0)