debian-mirror-gitlab/lib/gitlab/auth/blocked_user_tracker.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
500 B
Ruby
Raw Normal View History

2018-03-17 18:26:18 +05:30
# frozen_string_literal: true
module Gitlab
module Auth
class BlockedUserTracker
2018-11-18 11:00:15 +05:30
def initialize(user, auth)
@user = user
@auth = auth
end
2018-03-17 18:26:18 +05:30
2018-11-18 11:00:15 +05:30
def log_activity!
return unless @user.blocked?
2018-03-17 18:26:18 +05:30
2018-11-18 11:00:15 +05:30
Gitlab::AppLogger.info <<~INFO
"Failed login for blocked user: user=#{@user.username} ip=#{@auth.request.ip}")
INFO
2018-03-17 18:26:18 +05:30
2018-11-18 11:00:15 +05:30
SystemHooksService.new.execute_hooks_for(@user, :failed_login)
2018-03-17 18:26:18 +05:30
rescue TypeError
end
end
end
end