blob: 59f0dc8f81961982e1177c97a22597aa96203602 (
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
|
# frozen_string_literal: true
module RecaptchaHelper
def recaptcha_enabled?
return false if gitlab_qa?
!!Gitlab::Recaptcha.enabled?
end
alias_method :show_recaptcha_sign_up?, :recaptcha_enabled?
def recaptcha_enabled_on_login?
return false if gitlab_qa?
Gitlab::Recaptcha.enabled_on_login?
end
private
def gitlab_qa?
return false unless Gitlab.com?
return false unless request.user_agent.present?
return false unless Gitlab::Environment.qa_user_agent.present?
ActiveSupport::SecurityUtils.secure_compare(request.user_agent, Gitlab::Environment.qa_user_agent)
end
end
RecaptchaHelper.prepend_mod
|