Skip to content

Commit 065ee36

Browse files
committed
skip self Prohibit Login in post event handle
1 parent 2c120af commit 065ee36

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

routers/admin/users.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,13 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
243243
u.AllowGitHook = form.AllowGitHook
244244
u.AllowImportLocal = form.AllowImportLocal
245245
u.AllowCreateOrganization = form.AllowCreateOrganization
246-
u.ProhibitLogin = form.ProhibitLogin
246+
247+
// skip slef Prohibit Login
248+
if ctx.User.ID == u.ID {
249+
u.ProhibitLogin = false
250+
} else {
251+
u.ProhibitLogin = form.ProhibitLogin
252+
}
247253

248254
if err := models.UpdateUser(u); err != nil {
249255
if models.IsErrEmailAlreadyUsed(err) {

0 commit comments

Comments
 (0)