Skip to content

Commit b5f846f

Browse files
committed
prevent linking if account disabled
1 parent 818c330 commit b5f846f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

routers/web/auth/oauth.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ func SignInOAuthCallback(ctx *context.Context) {
217217
}
218218

219219
if hasUser {
220+
if user.ProhibitLogin || !user.IsActive {
221+
log.Info("Failed authentication attempt for %s from %s: user has disabled sign-in", user.Name, ctx.RemoteAddr())
222+
ctx.Flash.Error(ctx.Tr("auth.prohibit_login"))
223+
ctx.Redirect(setting.AppSubURL + "/user/login")
224+
return
225+
}
220226
if err := externalaccount.LinkAccountToUser(ctx, authSource.ID, user, gothUser); err != nil {
221227
ctx.ServerError("LinkAccountToUser", err)
222228
return

0 commit comments

Comments
 (0)