2018-10-22 03:00:50 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-12-28 15:21:34 -05:00
|
|
|
module Gitlab
|
|
|
|
module Recaptcha
|
2021-01-27 04:09:01 -05:00
|
|
|
extend Gitlab::Utils::StrongMemoize
|
|
|
|
|
2015-12-28 15:21:34 -05:00
|
|
|
def self.load_configurations!
|
2021-01-27 04:09:01 -05:00
|
|
|
if enabled? || enabled_on_login?
|
2015-12-28 15:21:34 -05:00
|
|
|
::Recaptcha.configure do |config|
|
2019-03-08 06:54:03 -05:00
|
|
|
config.site_key = Gitlab::CurrentSettings.recaptcha_site_key
|
|
|
|
config.secret_key = Gitlab::CurrentSettings.recaptcha_private_key
|
2015-12-28 15:21:34 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
2017-01-27 11:25:39 -05:00
|
|
|
|
|
|
|
def self.enabled?
|
2018-02-02 13:39:55 -05:00
|
|
|
Gitlab::CurrentSettings.recaptcha_enabled
|
2017-01-27 11:25:39 -05:00
|
|
|
end
|
2019-07-18 04:27:02 -04:00
|
|
|
|
|
|
|
def self.enabled_on_login?
|
|
|
|
Gitlab::CurrentSettings.login_recaptcha_protection_enabled
|
|
|
|
end
|
2015-12-28 15:21:34 -05:00
|
|
|
end
|
|
|
|
end
|
2021-06-28 02:07:45 -04:00
|
|
|
|
|
|
|
# call prepend_mod to ensure JH-specific module run even though there is no corresponding EE-specific module
|
|
|
|
Gitlab::Recaptcha.prepend_mod
|