Skip Menu |

This queue is for tickets about the HTML-FormFu-Element-reCAPTCHA CPAN distribution.

Report information
The Basics
Id: 127135
Status: new
Priority: 0/
Queue: HTML-FormFu-Element-reCAPTCHA

People
Owner: Nobody in particular
Requestors: felix.ostmann [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.00
Fixed in: 1.00



Subject: reCAPTCHA v2 required
Hello, this module is out of order, because google don't support version 1 anymore. But the good news: v2 is most compatible. There are only 2 small changes needed: diff --git a/dist.ini b/dist.ini index 72d3d5f..b7a2be5 100644 --- a/dist.ini +++ b/dist.ini @@ -7,7 +7,7 @@ copyright_year = 2013 version = 1.00 [Prereqs] -Captcha::reCAPTCHA = 0.93 +Captcha::reCAPTCHA = 0.98 Clone = 0.31 HTML::FormFu = 1.00 Moose = 1.00 diff --git a/lib/HTML/FormFu/Constraint/reCAPTCHA.pm b/lib/HTML/FormFu/Constraint/reCAPTCHA.pm index 6ec095c..8c92058 100644 --- a/lib/HTML/FormFu/Constraint/reCAPTCHA.pm +++ b/lib/HTML/FormFu/Constraint/reCAPTCHA.pm @@ -57,7 +57,7 @@ sub process { : $ENV{REMOTE_ADDR}; my $result - = $captcha->check_answer( $privkey, $remoteip, $challenge, $response, ); + = $captcha->check_answer_v2( $privkey, $remoteip, $challenge, $response, ); # they're human! if ( $result->{is_valid} ) { diff --git a/lib/HTML/FormFu/Element/reCAPTCHA.pm b/lib/HTML/FormFu/Element/reCAPTCHA.pm index 0a488d1..2a9cf62 100644 --- a/lib/HTML/FormFu/Element/reCAPTCHA.pm +++ b/lib/HTML/FormFu/Element/reCAPTCHA.pm @@ -80,7 +80,7 @@ sub render_data_non_recursive { my $recaptcha = Captcha::reCAPTCHA->new; my $recaptcha_html - = $recaptcha->get_html( $pubkey, $error, $use_ssl, $recaptcha_options, + = $recaptcha->get_html_v2( $pubkey, $error, $use_ssl, $recaptcha_options, ); my $render = $self->SUPER::render_data_non_recursive( {
Forgot the important internal changes ... diff --git a/dist.ini b/dist.ini index 72d3d5f..a7d8f66 100644 --- a/dist.ini +++ b/dist.ini @@ -4,10 +4,10 @@ license = Perl_5 copyright_holder = Carl Franks copyright_year = 2013 -version = 1.00 +version = 2.00 [Prereqs] -Captcha::reCAPTCHA = 0.93 +Captcha::reCAPTCHA = 0.98 Clone = 0.31 HTML::FormFu = 1.00 Moose = 1.00 diff --git a/lib/HTML/FormFu/Constraint/reCAPTCHA.pm b/lib/HTML/FormFu/Constraint/reCAPTCHA.pm index 6ec095c..fc8fcd3 100644 --- a/lib/HTML/FormFu/Constraint/reCAPTCHA.pm +++ b/lib/HTML/FormFu/Constraint/reCAPTCHA.pm @@ -18,13 +18,12 @@ sub process { # real formfu fields, so they won't be in $params my $query = $self->form->query; - my $challenge = $query->param('recaptcha_challenge_field'); - my $response = $query->param('recaptcha_response_field'); + my $response = $query->param('g-recaptcha-response'); # constraints are only run if submitted() is true. # the recaptcha fields have an implicit Required constraint # so throw an error if either field is missing - if ( !$challenge || !$response ) { + if ( !$response ) { return $self->mk_errors( {} ); } @@ -57,7 +56,7 @@ sub process { : $ENV{REMOTE_ADDR}; my $result - = $captcha->check_answer( $privkey, $remoteip, $challenge, $response, ); + = $captcha->check_answer_v2( $privkey, $response, $remoteip, ); # they're human! if ( $result->{is_valid} ) { diff --git a/lib/HTML/FormFu/Element/reCAPTCHA.pm b/lib/HTML/FormFu/Element/reCAPTCHA.pm index 0a488d1..2a9cf62 100644 --- a/lib/HTML/FormFu/Element/reCAPTCHA.pm +++ b/lib/HTML/FormFu/Element/reCAPTCHA.pm @@ -80,7 +80,7 @@ sub render_data_non_recursive { my $recaptcha = Captcha::reCAPTCHA->new; my $recaptcha_html - = $recaptcha->get_html( $pubkey, $error, $use_ssl, $recaptcha_options, + = $recaptcha->get_html_v2( $pubkey, $error, $use_ssl, $recaptcha_options, ); my $render = $self->SUPER::render_data_non_recursive( {