Skip Menu |

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

Report information
The Basics
Id: 94462
Status: patched
Priority: 0/
Queue: Mojolicious-Plugin-Captcha

People
Owner: ZAR [...] cpan.org
Requestors: qd1qupwe.hs2 [...] 20minutemail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.01
Fixed in: 0.02



Subject: [Patch included] Fix bug and and small opt
Hello. Nice plugin, good job but there is a small bug for that comparing: [code] uc($string) eq &{$captcha_string} [/code] You can catch bug if run plugin with [code] rnd_data => [0...9, 'A'...'Z', 'a'...'z'], [/code] Attached patch resolve that problem and add optional feature to make a case sensitive validation. Please apply patch. Thank You, anonymous
Subject: captcha.patch
diff --git a/Captcha.pm b/Captcha.pm index a29541c..c6ef1ef 100644 --- a/Captcha.pm +++ b/Captcha.pm @@ -7,7 +7,7 @@ use Mojo::Base 'Mojolicious::Plugin'; use GD::SecurityImage; -our $VERSION = 0.01; +our $VERSION = 0.02; sub register { my ($self, $app, $conf) = @_; @@ -40,11 +40,12 @@ sub register { $app->helper( validate_captcha => sub { - my ( $self, $string ) = @_; - return - uc($string) eq &{$captcha_string} - ? 1 - : 0; + my ( $self, $string, $case_sens) = @_; + !!($case_sens ? ( + $string eq &{$captcha_string} + ) : ( + uc($string) eq uc(&{$captcha_string}) + )); } ); } @@ -57,7 +58,7 @@ Mojolicious::Plugin::Captcha - create and validate captcha for Mojolicious frame =head1 VERSION -0.01 +0.02 =head1 SYNOPSIS @@ -109,6 +110,11 @@ Create Captcha image and output it. Validate captcha string + Accept optional second parameter to switch comparator case sensitivity (default is off, i.e. comparator make case insensivity comparing) + + # case sensitivity comparing + $self->validate_captcha($self->param('captcha'), 1); + =head1 CONFIGURATION =over 4
RT-Send-CC: qd1qupwe.hs2 [...] 20minutemail.com
Hello Sorry for long waiting Суб Апр 05 10:08:59 2014, anonymous писал: Show quoted text
> Hello. > Nice plugin, good job but there is a small bug for that comparing: > [code] > uc($string) eq &{$captcha_string} > [/code] > You can catch bug if run plugin with > [code] > rnd_data => [0...9, 'A'...'Z', 'a'...'z'], > [/code] > > Attached patch resolve that problem and add optional feature to make a > case sensitive validation. > > Please apply patch. > > Thank You, > anonymous
Суб Апр 05 10:08:59 2014, anonymous писал: Show quoted text
> Hello. > Nice plugin, good job but there is a small bug for that comparing: > [code] > uc($string) eq &{$captcha_string} > [/code] > You can catch bug if run plugin with > [code] > rnd_data => [0...9, 'A'...'Z', 'a'...'z'], > [/code] > > Attached patch resolve that problem and add optional feature to make a > case sensitive validation. > > Please apply patch. > > Thank You, > anonymous