@@ -275,6 +275,7 @@ func EditUserPost(ctx *context.Context) {
275
275
ctx .Data ["PageIsAdmin" ] = true
276
276
ctx .Data ["PageIsAdminUsers" ] = true
277
277
ctx .Data ["DisableMigrations" ] = setting .Repository .DisableMigrations
278
+ ctx .Data ["AllowedUserVisibilityModes" ] = setting .Service .AllowedUserVisibilityModesSlice .ToVisibleTypeSlice ()
278
279
279
280
u := prepareUserInfo (ctx )
280
281
if ctx .Written () {
@@ -316,13 +317,13 @@ func EditUserPost(ctx *context.Context) {
316
317
log .Error (err .Error ())
317
318
errMsg = ctx .Tr ("auth.password_pwned_err" )
318
319
}
319
- ctx .RenderWithErr (errMsg , tplUserNew , & form )
320
+ ctx .RenderWithErr (errMsg , tplUserEdit , & form )
320
321
return
321
322
}
322
323
323
324
if err := user_model .ValidateEmail (form .Email ); err != nil {
324
325
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 )
326
327
return
327
328
}
328
329
@@ -338,7 +339,10 @@ func EditUserPost(ctx *context.Context) {
338
339
339
340
if len (form .UserName ) != 0 && u .Name != form .UserName {
340
341
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 )
342
346
return
343
347
}
344
348
u .Name = form .UserName
0 commit comments