2018-01-15 05:10:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
|
|
module Auth
|
|
|
|
class BlockedUserTracker
|
2018-08-01 13:56:44 +00:00
|
|
|
def initialize(user, auth)
|
|
|
|
@user = user
|
|
|
|
@auth = auth
|
2018-07-20 14:00:28 +00:00
|
|
|
end
|
2018-01-15 05:10:48 +00:00
|
|
|
|
2018-08-01 15:08:59 +00:00
|
|
|
def log_activity!
|
2018-08-01 13:56:44 +00:00
|
|
|
return unless @user.blocked?
|
2018-07-27 11:54:31 +00:00
|
|
|
|
2018-08-01 13:56:44 +00:00
|
|
|
Gitlab::AppLogger.info <<~INFO
|
|
|
|
"Failed login for blocked user: user=#{@user.username} ip=#{@auth.request.ip}")
|
|
|
|
INFO
|
2018-07-27 11:54:31 +00:00
|
|
|
|
2018-08-01 13:56:44 +00:00
|
|
|
SystemHooksService.new.execute_hooks_for(@user, :failed_login)
|
|
|
|
rescue TypeError
|
2018-07-27 11:54:31 +00:00
|
|
|
end
|
2018-01-15 05:10:48 +00:00
|
|
|
end
|
|
|
|
end
|
2018-08-03 10:58:00 +00:00
|
|
|
end
|