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

recaptcha.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1e9f6c497c03624235a98dc066174686e52499c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Gitlab
  module Recaptcha
    extend Gitlab::Utils::StrongMemoize

    def self.load_configurations!
      if enabled? || enabled_on_login?
        ::Recaptcha.configure do |config|
          config.site_key = Gitlab::CurrentSettings.recaptcha_site_key
          config.secret_key = Gitlab::CurrentSettings.recaptcha_private_key
        end

        true
      end
    end

    def self.enabled?
      Gitlab::CurrentSettings.recaptcha_enabled
    end

    def self.enabled_on_login?
      Gitlab::CurrentSettings.login_recaptcha_protection_enabled
    end
  end
end

# call prepend_mod to ensure JH-specific module run even though there is no corresponding EE-specific module
Gitlab::Recaptcha.prepend_mod