Skip Menu |

This queue is for tickets about the Catalyst-Plugin-Captcha CPAN distribution.

Report information
The Basics
Id: 52099
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-Captcha

People
Owner: DIEGOK [...] cpan.org
Requestors: Support [...] RoxSoft.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.03
Fixed in: (no value)



Subject: New release required for Catalyst 5.8
Since the release of Catalyst 5.8001401 the use of NEXT is deprecated in favour of MRO::Compat and the standard is now to use Plugin::Captcha as the config key. Attached is a patch that implements this
Subject: Captcha.diff
--- Catalyst/Plugin/Captcha.pm 2009-11-26 19:17:41.000000000 +0000 +++ Catalyst/Plugin/Captcha.pm 2009-11-26 20:17:39.000000000 +0000 @@ -5,25 +5,31 @@ use GD::SecurityImage; use HTTP::Date; -our $VERSION = '0.03'; +our $VERSION = '0.04'; + +use MRO::Compat; sub setup { - my $c = shift; + my $c = shift; + my $config = $c->config->{ 'Plugin::Captcha' } + || delete $c->config->{captcha}; # Deprecated + + $config->{session_name} ||= 'captcha_string'; + $config->{captcha}->{new} ||= {}; + $config->{captcha}->{create} ||= []; + $config->{captcha}->{particle} ||= []; + $config->{captcha}->{out} ||= {}; - $c->config->{captcha}->{session_name} = 'captcha_string'; - $c->config->{captcha}->{new} ||= {}; - $c->config->{captcha}->{create} ||= []; - $c->config->{captcha}->{particle} ||= []; - $c->config->{captcha}->{out} ||= {}; + $c->config( 'Plugin::Captcha' => $config ); - return $c->NEXT::setup(@_); + return $c->next::method( @_ ); } sub create_captcha { - my $c = shift; - my $conf = $c->config->{captcha}; - + my $c = shift; + my $conf = $c->config->{ 'Plugin::Captcha' }; my $image = GD::SecurityImage->new( %{ $conf->{new} } ); + $image->random(); $image->create( @{ $conf->{create} } ); $image->particle( @{ $conf->{particle} } ); @@ -31,7 +37,7 @@ my ( $image_data, $mime_type, $random_string ) = $image->out( %{ $conf->{out} } ); - $c->session->{ $c->config->{captcha}->{session_name} } = $random_string; + $c->session->{ $conf->{session_name} } = $random_string; $c->res->headers->expires( time() ); $c->res->headers->header( 'Last-Modified' => HTTP::Date::time2str ); @@ -49,17 +55,20 @@ } sub captcha_string { - my $c = shift; - return $c->session->{ $c->config->{captcha}->{session_name} }; + my $c = shift; + my $conf = $c->config->{ 'Plugin::Captcha' }; + + return $c->session->{ $conf->{session_name} }; } sub clear_captcha_string { - my $c = shift; - delete $c->session->{ $c->config->{captcha}->{session_name} }; + my $c = shift; + my $conf = $c->config->{ 'Plugin::Captcha' }; + + delete $c->session->{ $conf->{session_name} }; return 1; } - 1; __END__ # Below is stub documentation for your module. You'd better edit it! @@ -72,7 +81,7 @@ use Catalyst qw/Captcha/; - MyApp->config->{captcha} = { + MyApp->config->{ 'Plugin::Captcha' } = { session_name => 'captcha_string', new => { width => 80,
Could we please have a release with this patch? I'm worried about Captchas not working anymore after some future upgrade...
Hi!, On Wed Mar 24 05:54:11 2010, NINE wrote: Show quoted text
> Could we please have a release with this patch? I'm worried about Captchas > not working anymore after some future upgrade...
I've cloned the gitpan repo, applied the patch and prepared everything to hit cpan. I'm trying to contact the author to upload this or if this is not possible, start maintaining the module. In the meantime you can install from: http://github.com/diegok/Catalyst-Plugin-Captcha
I've finally reached kazeburo on github an he gently grant me as co-maint so version 0.04 is now on cpan: http://search.cpan.org/~diegok/Catalyst-Plugin-Captcha-0.04/