From 984976a2f7105098321fb68a8e1e30763032ecec Mon Sep 17 00:00:00 2001 From: "Dominik M. Kwiatek" Date: Fri, 22 May 2020 21:42:10 +0100 Subject: [PATCH] Omit hCaptcha if it is disabled --- app/controllers/user/registrations_controller.rb | 2 +- app/views/devise/registrations/new.haml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/user/registrations_controller.rb b/app/controllers/user/registrations_controller.rb index 181ae2a3..d4167563 100644 --- a/app/controllers/user/registrations_controller.rb +++ b/app/controllers/user/registrations_controller.rb @@ -1,6 +1,6 @@ class User::RegistrationsController < Devise::RegistrationsController def create - if verify_hcaptcha(model: resource) + if !APP_CONFIG.dig(:hcaptcha, :enabled) || verify_hcaptcha(model: resource) super else respond_with_navigational(resource){ redirect_to new_user_registration_path } diff --git a/app/views/devise/registrations/new.haml b/app/views/devise/registrations/new.haml index 521c3d57..35d6c10e 100644 --- a/app/views/devise/registrations/new.haml +++ b/app/views/devise/registrations/new.haml @@ -14,7 +14,8 @@ = f.password_field :password, autocomplete: :off, label: t('views.settings.account.password') = f.password_field :password_confirmation, autocomplete: :off, label: t('views.settings.account.password_confirm') - = hcaptcha_tags + - if APP_CONFIG.dig(:hcaptcha, :enabled) + = hcaptcha_tags %p= raw t('views.sessions.info', terms: link_to(t('views.general.terms'), terms_path)) = f.submit 'Sign up', class: 'btn btn-primary mb-3'