diff --git a/routers/admin/users.go b/routers/admin/users.go index 10ae622c3..a28db2b44 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 da75cb506..feeaacbba 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -74,7 +74,7 @@