Welcome to mirror list, hosted at ThFree Co, Russian Federation.

blocked_user_tracker.rb « auth « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 50712d7eac2c6fb23eeec88374da648df9b82d41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true
module Gitlab
  module Auth
    class BlockedUserTracker
      def initialize(user, auth)
        @user = user
        @auth = auth
      end

      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
    end
  end
end