debian-mirror-gitlab/app/helpers/recaptcha_helper.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
651 B
Ruby
Raw Normal View History

2021-01-29 00:20:46 +05:30
# frozen_string_literal: true
module RecaptchaHelper
2021-12-11 22:18:48 +05:30
def recaptcha_enabled?
2022-11-25 23:54:43 +05:30
return false if gitlab_qa?
2021-01-29 00:20:46 +05:30
!!Gitlab::Recaptcha.enabled?
end
2021-12-11 22:18:48 +05:30
alias_method :show_recaptcha_sign_up?, :recaptcha_enabled?
2022-11-25 23:54:43 +05:30
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
2021-01-29 00:20:46 +05:30
end
2021-11-11 11:23:49 +05:30
RecaptchaHelper.prepend_mod