Skip to content

Commit

Permalink
Move shortcut to top of recaptcha method
Browse files Browse the repository at this point in the history
  • Loading branch information
denny committed Aug 20, 2019
1 parent e4285c4 commit 30f83ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ShinyCMS/Controller.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ Checks to see if a recaptcha submission is good.
sub recaptcha_result {
my( $self, $c ) = @_;

# Shortcut the reCaptcha check; used by test suite
return { is_valid => 1 } if $ENV{ RECAPTCHA_OFF };

my $rc = Captcha::reCAPTCHA->new;

my $result = $rc->check_answer_v2(
$c->config->{ 'recaptcha_private_key' },
$c->request->param( 'g-recaptcha-response' ),
$c->request->address,
);

return { is_valid => 1 } if $ENV{ RECAPTCHA_OFF };
return $result;
}

Expand Down

0 comments on commit 30f83ca

Please sign in to comment.