2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
module Gitlab
|
|
|
|
module Recaptcha
|
2021-03-11 19:13:27 +05:30
|
|
|
extend Gitlab::Utils::StrongMemoize
|
|
|
|
|
2016-01-14 18:37:52 +05:30
|
|
|
def self.load_configurations!
|
2021-03-11 19:13:27 +05:30
|
|
|
if enabled? || enabled_on_login?
|
2016-01-14 18:37:52 +05:30
|
|
|
::Recaptcha.configure do |config|
|
2019-07-07 11:18:12 +05:30
|
|
|
config.site_key = Gitlab::CurrentSettings.recaptcha_site_key
|
|
|
|
config.secret_key = Gitlab::CurrentSettings.recaptcha_private_key
|
2016-01-14 18:37:52 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
def self.enabled?
|
2018-03-17 18:26:18 +05:30
|
|
|
Gitlab::CurrentSettings.recaptcha_enabled
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
def self.enabled_on_login?
|
|
|
|
Gitlab::CurrentSettings.login_recaptcha_protection_enabled
|
|
|
|
end
|
2016-01-14 18:37:52 +05:30
|
|
|
end
|
|
|
|
end
|
2021-09-30 23:02:18 +05:30
|
|
|
|
|
|
|
# call prepend_mod to ensure JH-specific module run even though there is no corresponding EE-specific module
|
|
|
|
Gitlab::Recaptcha.prepend_mod
|