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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/recaptcha_helper.rb')
-rw-r--r--app/helpers/recaptcha_helper.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/recaptcha_helper.rb b/app/helpers/recaptcha_helper.rb
index 5b17ab4b815..59f0dc8f819 100644
--- a/app/helpers/recaptcha_helper.rb
+++ b/app/helpers/recaptcha_helper.rb
@@ -2,9 +2,27 @@
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