diff options
author | Stan Hu <stanhu@gmail.com> | 2017-06-09 12:28:47 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-06-09 22:28:28 -0700 |
commit | b3b754fd86ad10c2bd396b4d5b21877a6a44b159 (patch) | |
tree | b83a03e18b85434208b7a5e635402002369c825d /app/controllers | |
parent | b134f950d70bdb73bc76e9a9091c0a50a6b8b8cd (diff) | |
download | gitlab-ce-sh-init-recaptcha.tar.gz |
Load reCAPTCHA config at init time and when application settings changesh-init-recaptcha
Closes #33532
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/concerns/spammable_actions.rb | 2 | ||||
-rw-r--r-- | app/controllers/registrations_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/sessions_controller.rb | 5 |
3 files changed, 2 insertions, 7 deletions
diff --git a/app/controllers/concerns/spammable_actions.rb b/app/controllers/concerns/spammable_actions.rb index d0a692070d9..004872ff4ca 100644 --- a/app/controllers/concerns/spammable_actions.rb +++ b/app/controllers/concerns/spammable_actions.rb @@ -35,7 +35,7 @@ module SpammableActions default_params = { request: request } recaptcha_check = params[:recaptcha_verification] && - Gitlab::Recaptcha.load_configurations! && + Gitlab::Recaptcha.enabled? && verify_recaptcha return default_params unless recaptcha_check diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 1bc6520370a..1e46e25b6fb 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -13,7 +13,7 @@ class RegistrationsController < Devise::RegistrationsController params[resource_name] = params.delete(:"new_#{resource_name}") end - if !Gitlab::Recaptcha.load_configurations! || verify_recaptcha + if !Gitlab::Recaptcha.enabled? || verify_recaptcha super else flash[:alert] = 'There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.' diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index d7c702b94f8..345e411f30b 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -11,7 +11,6 @@ class SessionsController < Devise::SessionsController prepend_before_action :store_redirect_path, only: [:new] before_action :auto_sign_in_with_provider, only: [:new] - before_action :load_recaptcha def new set_minimum_password_length @@ -137,10 +136,6 @@ class SessionsController < Devise::SessionsController Users::ActivityService.new(user, 'login').execute end - def load_recaptcha - Gitlab::Recaptcha.load_configurations! - end - def authentication_method if user_params[:otp_attempt] "two-factor" |