[Catalyst-commits] r6941 - /
trunk/Catalyst-Controller-reCAPTCHA/lib/Catalyst/Controller
trunk/Catalyst-Controller-reCAPTCHA/t/lib/TestApp/Controller
zarquon at dev.catalyst.perl.org
zarquon at dev.catalyst.perl.org
Tue Sep 25 01:54:15 GMT 2007
Author: zarquon
Date: 2007-09-25 01:54:14 +0100 (Tue, 25 Sep 2007)
New Revision: 6941
Modified:
/
trunk/Catalyst-Controller-reCAPTCHA/lib/Catalyst/Controller/reCAPTCHA.pm
trunk/Catalyst-Controller-reCAPTCHA/t/lib/TestApp/Controller/Root.pm
Log:
r11774 at zaphod: kd | 2007-09-25 10:11:20 +1000
some patches to improve clarity of use, thanks nothingmuch
Property changes on:
___________________________________________________________________
Name: svk:merge
- 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:11770
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
+ 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:11774
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
Modified: trunk/Catalyst-Controller-reCAPTCHA/lib/Catalyst/Controller/reCAPTCHA.pm
===================================================================
--- trunk/Catalyst-Controller-reCAPTCHA/lib/Catalyst/Controller/reCAPTCHA.pm 2007-09-24 22:56:08 UTC (rev 6940)
+++ trunk/Catalyst-Controller-reCAPTCHA/lib/Catalyst/Controller/reCAPTCHA.pm 2007-09-25 00:54:14 UTC (rev 6941)
@@ -3,7 +3,7 @@
use warnings;
use base 'Catalyst::Controller';
use Captcha::reCAPTCHA;
-our $VERSION = '0.1';
+our $VERSION = '0.2';
sub captcha_get : Private {
@@ -24,7 +24,8 @@
);
}
else {
- $c->stash->{recaptcha_ok} = "User appears not to have submitted a recaptcha";
+ $c->stash->{recaptcha_ok} = $result->{is_valid};
+ $c->stash->{recaptcha_error} = $result->{error} || "User appears not to have submitted a recaptcha";
}
if ( $result->{is_valid} ) {
@@ -66,8 +67,9 @@
captcha_check : Private
Validates the reCaptcha using L<Captcha::reCAPTCHA>. sets
-$c->stash->{recaptcha_ok} which will be 1 on success or an error
-string provided by L<Captcha::reCAPTCHA> on failure.
+$c->stash->{recaptcha_ok} which will be 1 on success. If there's an
+error, $c->stash->{recaptcha_error} is set with the error string
+provided by L<Captcha::reCAPTCHA>.
=head2 EXAMPLES
Modified: trunk/Catalyst-Controller-reCAPTCHA/t/lib/TestApp/Controller/Root.pm
===================================================================
--- trunk/Catalyst-Controller-reCAPTCHA/t/lib/TestApp/Controller/Root.pm 2007-09-24 22:56:08 UTC (rev 6940)
+++ trunk/Catalyst-Controller-reCAPTCHA/t/lib/TestApp/Controller/Root.pm 2007-09-25 00:54:14 UTC (rev 6941)
@@ -9,7 +9,7 @@
sub index :Private {
my ($self, $c) = @_;
$c->forward('captcha_get');
- my $body ='<html> <body> <p> recaptcha error: '. $c->stash->{recaptcha_ok} . '</p><form name="recaptcha" action="'. $c->uri_for('/check') . '" method="post">'. $c->stash->{recaptcha}.' <br/> <input type="submit" value="submit" /> </form>';
+ my $body ='<html> <body> <p> recaptcha error: '. $c->stash->{recaptcha_ok} . " " . $c->stash->{recaptcha_error} . '</p><form name="recaptcha" action="'. $c->uri_for('/check') . '" method="post">'. $c->stash->{recaptcha}.' <br/> <input type="submit" value="submit" /> </form>';
$c->res->body($body);
}
More information about the Catalyst-commits
mailing list