From f821c8387cd6b1fd8b41728f3a2fb82a7f71d34e Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Mon, 17 Jun 2024 14:09:19 -0700 Subject: [PATCH] Execute reCAPTCHA on form submit Otherwise we run the risk of a reCAPTCHA timeout (2 minutes) --- .../blacklight/top_navbar_component.html.erb | 14 ++++++++++++-- spec/features/feedback_form_spec.rb | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/components/blacklight/top_navbar_component.html.erb b/app/components/blacklight/top_navbar_component.html.erb index 7be20897..2fcda01d 100644 --- a/app/components/blacklight/top_navbar_component.html.erb +++ b/app/components/blacklight/top_navbar_component.html.erb @@ -14,7 +14,7 @@
- <%= form_with url: feedback_path, method: :post, class: 'col-md-8' do |f| %> + <%= form_with url: feedback_path, method: :post, class: 'col-md-8', html: { name: 'feedback_form' } do |f| %> <%= f.hidden_field :reporting_from, value: request.original_url %>
- <%= recaptcha_v3(action: 'feedback', turbolinks: true) %> + <%= recaptcha_v3(action: 'feedback') %> +
diff --git a/spec/features/feedback_form_spec.rb b/spec/features/feedback_form_spec.rb index 81a1f45a..fc0d1892 100644 --- a/spec/features/feedback_form_spec.rb +++ b/spec/features/feedback_form_spec.rb @@ -10,7 +10,7 @@ click_on 'Feedback' within '#feedback' do - expect(page).to have_css('form') + expect(page).to have_css('form[name="feedback_form"]') end end end