Class: Gitlab::Auth::BlockedUserTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/auth/blocked_user_tracker.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, auth) ⇒ BlockedUserTracker

Returns a new instance of BlockedUserTracker.


5
6
7
8
# File 'lib/gitlab/auth/blocked_user_tracker.rb', line 5

def initialize(user, auth)
  @user = user
  @auth = auth
end

Instance Method Details

#log_activity!Object


10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/auth/blocked_user_tracker.rb', line 10

def log_activity!
  return unless @user.blocked?

  Gitlab::AppLogger.info <<~INFO
    "Failed login for blocked user: user=#{@user.username} ip=#{@auth.request.ip}")
  INFO

  SystemHooksService.new.execute_hooks_for(@user, :failed_login)
rescue TypeError
end