diff --git a/app/controllers/nominate_practices_controller.rb b/app/controllers/nominate_practices_controller.rb index 7d1e1f73e..7dc8777a1 100644 --- a/app/controllers/nominate_practices_controller.rb +++ b/app/controllers/nominate_practices_controller.rb @@ -8,7 +8,7 @@ def email handle_nomination else begin - recaptcha_result = verify_recaptcha(action: 'email', minimum_score: 0.3) + recaptcha_result = verify_recaptcha(action: 'email', minimum_score: 0.5) if recaptcha_result handle_nomination diff --git a/app/views/shared/_email_form.html.erb b/app/views/shared/_email_form.html.erb index 91700d422..7289a5e3c 100644 --- a/app/views/shared/_email_form.html.erb +++ b/app/views/shared/_email_form.html.erb @@ -19,5 +19,8 @@ - <%= recaptcha_v3(action: 'email', turbo: 'true', site_key: ENV['RECAPTCHA_SITE_KEY_V3']) if ENV['RECAPTCHA_SITE_KEY_V3'] %> + <% unless current_user.present? %> + + <%= recaptcha_v3(action: 'email', turbo: 'true', site_key: ENV['RECAPTCHA_SITE_KEY_V3']) if ENV['RECAPTCHA_SITE_KEY_V3'] %> + <% end %> <% end %> diff --git a/spec/features/nominate_practices/nominate_a_practice_page_spec.rb b/spec/features/nominate_practices/nominate_a_practice_page_spec.rb index 40371a4bd..4d707f88a 100644 --- a/spec/features/nominate_practices/nominate_a_practice_page_spec.rb +++ b/spec/features/nominate_practices/nominate_a_practice_page_spec.rb @@ -5,6 +5,7 @@ it 'renders form' do visit '/nominate-an-innovation' expect(page).to be_accessible.according_to :wcag2a, :section508 + expect(page).to have_css('#recaptcha-placeholder', visible: false) expect(page).to have_content('Nominate an innovation') expect(page).to have_content('VA staff and collaborators are welcome to nominate active innovations for consideration on the Diffusion Marketplace using the form below.') end @@ -13,6 +14,13 @@ visit '/nominate-a-practice' expect(page).to have_current_path(nominate_an_innovation_path) end + + it 'does not render reCAPTCHA for VA users' do + @user = User.create!(email: 'spongebob.squarepants@va.gov', password: 'Password123', password_confirmation: 'Password123', skip_va_validation: true, confirmed_at: Time.now, accepted_terms: true) + login_as(@user, :scope => :user, :run_callbacks => false) + visit '/nominate-an-innovation' + expect(page).not_to have_selector('#recaptcha-placeholder') + end end context 'Email' do