diff --git a/routers/admin/users.go b/routers/admin/users.go index 10ae622c323..a28db2b4453 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -243,7 +243,13 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) { u.AllowGitHook = form.AllowGitHook u.AllowImportLocal = form.AllowImportLocal u.AllowCreateOrganization = form.AllowCreateOrganization - u.ProhibitLogin = form.ProhibitLogin + + // skip self Prohibit Login + if ctx.User.ID == u.ID { + u.ProhibitLogin = false + } else { + u.ProhibitLogin = form.ProhibitLogin + } if err := models.UpdateUser(u); err != nil { if models.IsErrEmailAlreadyUsed(err) { diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index da75cb5065c..feeaacbba23 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -74,7 +74,7 @@