summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2019-06-20 23:27:07 +1000
committerAsh McKenzie <amckenzie@gitlab.com>2019-06-25 12:40:04 +1000
commit6a4d2a18a37f930c02c62faf1580cafb217c96ab (patch)
tree734e442694b41c32c50c678a5afe741be1dd5998
parent7bac78e467704c4970878c646e0978b8ca10a620 (diff)
downloadgitlab-ce-ashmckenzie/new-user-signup-ab-test.tar.gz
Experiment - reCAPTCHA for sign upashmckenzie/new-user-signup-ab-test
This is a no-op for CE.
-rw-r--r--app/controllers/registrations_controller.rb2
-rw-r--r--app/views/devise/shared/_signup_box.html.haml2
-rw-r--r--spec/controllers/registrations_controller_spec.rb8
3 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 625424e85bb..b2b151bbcf0 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -3,6 +3,7 @@
class RegistrationsController < Devise::RegistrationsController
include Recaptcha::Verify
include AcceptsPendingInvitations
+ include RecaptchaExperimentHelper
prepend_before_action :check_captcha, only: :create
before_action :whitelist_query_limiting, only: [:destroy]
@@ -95,6 +96,7 @@ class RegistrationsController < Devise::RegistrationsController
ensure_correct_params!
return unless Feature.enabled?(:registrations_recaptcha, default_enabled: true) # reCAPTCHA on the UI will still display however
+ return unless show_recaptcha_sign_up?
return unless Gitlab::Recaptcha.load_configurations!
return if verify_recaptcha
diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml
index eae3ee6339f..034273558bb 100644
--- a/app/views/devise/shared/_signup_box.html.haml
+++ b/app/views/devise/shared/_signup_box.html.haml
@@ -33,7 +33,7 @@
= accept_terms_label.html_safe
= render_if_exists 'devise/shared/email_opted_in', f: f
%div
- - if Gitlab::Recaptcha.enabled?
+ - if show_recaptcha_sign_up?
= recaptcha_tags
.submit-container
= f.submit _("Register"), class: "btn-register btn qa-new-user-register-button"
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index 599093912ab..faf3c990cb2 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -107,6 +107,14 @@ describe RegistrationsController do
end
end
+ it "logs a 'User Created' message" do
+ stub_feature_flags(registrations_recaptcha: false)
+
+ expect(Gitlab::AppLogger).to receive(:info).with(/\AUser Created: username=new_username email=new@user.com.+\z/).and_call_original
+
+ post(:create, params: user_params)
+ end
+
it 'handles when params are new_user' do
post(:create, params: { new_user: base_user_params })