loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix incorrect/Improve error handle in edit user page (#23805)

Changes:
- `RenderWithErr` should render `tplUserEdit` not `tplUserNew` in edit
page
- If error occurred in `HandleUsernameChange` redirect to original edit
page instead of user list page

authored by

yp05327 and committed by
GitHub
06d9d9e4 ffd22697

+6 -3
+6 -3
routers/web/admin/users.go
··· 316 316 log.Error(err.Error()) 317 317 errMsg = ctx.Tr("auth.password_pwned_err") 318 318 } 319 - ctx.RenderWithErr(errMsg, tplUserNew, &form) 319 + ctx.RenderWithErr(errMsg, tplUserEdit, &form) 320 320 return 321 321 } 322 322 323 323 if err := user_model.ValidateEmail(form.Email); err != nil { 324 324 ctx.Data["Err_Email"] = true 325 - ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserNew, &form) 325 + ctx.RenderWithErr(ctx.Tr("form.email_error"), tplUserEdit, &form) 326 326 return 327 327 } 328 328 ··· 338 338 339 339 if len(form.UserName) != 0 && u.Name != form.UserName { 340 340 if err := user_setting.HandleUsernameChange(ctx, u, form.UserName); err != nil { 341 - ctx.Redirect(setting.AppSubURL + "/admin/users") 341 + if ctx.Written() { 342 + return 343 + } 344 + ctx.RenderWithErr(ctx.Flash.ErrorMsg, tplUserEdit, &form) 342 345 return 343 346 } 344 347 u.Name = form.UserName