mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2012-07-21 01:43 am

[dw-free] CAPTCHA issues with anonymous and OpenID comments

[commit: http://hg.dwscoalition.org/dw-free/rev/84bb40e76b17]

http://bugs.dwscoalition.org/show_bug.cgi?id=4513

Fix a problem with CAPTCHAs failing when the journal owner has selected
image captchas.

Patch by [personal profile] swaldman.

Files modified:
  • cgi-bin/LJ/Talk.pm
--------------------------------------------------------------------------------
diff -r 419c0af19ea5 -r 84bb40e76b17 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Fri Jul 20 18:02:23 2012 -0700
+++ b/cgi-bin/LJ/Talk.pm	Fri Jul 20 18:47:37 2012 -0700
@@ -2033,8 +2033,10 @@
 
     # Display captcha challenge if over rate limits.
     if ( $opts->{do_captcha} ) {
-        my $captcha = DW::Captcha->new( undef, want => $journalu->captcha_type );
+        my $captcha_type = $journalu->captcha_type;
+        my $captcha = DW::Captcha->new( undef, want => $captcha_type );
         $ret .= $captcha->print;
+        $ret .= "<input type='hidden' name='captcha_type' value='$captcha_type' />";
     }
 
     if ( $editid ) {
@@ -3736,6 +3738,7 @@
         # see if they're in the second+ phases of a captcha check.
         # are they sending us a response?
 
+        $form->{want} = $form->{captcha_type};
         my $captcha = DW::Captcha->new( undef, %{$form || {}} );
 
         if ( $captcha->enabled && $captcha->response ) {
--------------------------------------------------------------------------------