Skip to content

Commit

Permalink
[Surrey] Disable reCAPTCHA
Browse files Browse the repository at this point in the history
  • Loading branch information
davea committed Dec 3, 2024
1 parent d674546 commit 09f8525
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
10 changes: 10 additions & 0 deletions perllib/FixMyStreet/Cobrand/Surrey.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ sub enter_postcode_text { 'Enter a nearby UK postcode, or street name and area'
sub cut_off_date { '2024-09-16' }


=item * requires_recaptcha
Disable reCAPTCHA on this cobrand because we never see end users' IPs, only
those of the Imperva WAF, some of which are considered non-UK.
=cut

sub requires_recaptcha { 0 }

Check warning on line 76 in perllib/FixMyStreet/Cobrand/Surrey.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Surrey.pm#L76

Added line #L76 was not covered by tests


=head2 problems_restriction/problems_sql_restriction/problems_on_map_restriction
Reports made on FMS.com before the cut off date are not shown on the Surrey cobrand;
Expand Down
26 changes: 26 additions & 0 deletions t/app/controller/contact.t
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,32 @@ subtest 'recaptcha' => sub {
$mech->content_contains('Thank you for your enquiry');
};
};

subtest 'Surrey never shows reCAPTCHA' => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => 'surrey',
RECAPTCHA => { secret => 'secret', site_key => 'site_key' },
} => sub {
$mech->create_body_ok(
2242, 'Surrey County Council',
{ cobrand => 'surrey' },
);
ok $mech->host('tellus.surreycc.gov.uk');

$mod_app->mock( 'user_country', sub {'GB'} );

$mech->get_ok('/contact');
$mech->content_contains('Surrey County Council');
$mech->content_lacks('g-recaptcha');

$mod_app->mock( 'user_country', sub {'FR'} );

$mech->get_ok('/contact');
$mech->content_lacks('g-recaptcha');
$mech->submit_form_ok( { with_fields => \%common } );
$mech->content_contains('Thank you for your enquiry');
};
};
};

done_testing();

0 comments on commit 09f8525

Please sign in to comment.