I noticed there is a new release for CAPTCHA. Is there an update to the captcha patches? or can the existing ones be used.

CommentFileSizeAuthor
#5 ajax-captcha-support.patch6.41 KBcluke009

Comments

Countzero’s picture

I tried to patch manually on version 6-x-2.0, but it didn't work.

Great module by the way.

greenreaper’s picture

Here's a stab at modifying the existing patch for the standard math captcha.

--- captcha.module.orig 2009-12-15 19:53:16.000000000 -0500
+++ captcha.module      2009-12-15 19:56:39.000000000 -0500
@@ -250,6 +250,8 @@
     'type' => $captcha_type_challenge,
     'captcha_sid' => $captcha_sid,
     'solution' => $captcha['solution'],
+    'captcha_query' => $captcha['captcha_query'],
+    'captcha_type' => $captcha['type'],
   );

   return $element;
@@ -528,7 +530,10 @@
         $answer = mt_rand(1, 20);
         $x = mt_rand(1, $answer);
         $y = $answer - $x;
+        $query = t('@x + @y = ', array('@x' => $x, '@y' => $y));
         $result['solution'] = "$answer";
+        $result['query'] = $query;
+       $result['type'] = 'math';
         // Build challenge widget.
         // Note that we also use t() for the math challenge itself. This makes
         // it possible to 'rephrase' the challenge a bit through localization
@@ -537,7 +542,7 @@
           '#type' => 'textfield',
           '#title' => t('Math question'),
           '#description' => t('Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.'),
-          '#field_prefix' => t('@x + @y = ', array('@x' => $x, '@y' => $y)),
+          '#field_prefix' => $query,
           '#size' => 4,
           '#maxlength' => 2,
           '#required' => TRUE,
arski’s picture

hmm, the readme in the patches-for-captcha directory promises an updated set of patches for when a stable 2.x version of CAPTCHA is released.. which was on September 23, 2009.. :(( would appreciate these very very much!

bartezz’s picture

+1

cluke009’s picture

StatusFileSize
new6.41 KB

I was able to get this module to work against Captcha 6.x-2.4. So far only tested with Math captcha.

cluke009’s picture

Status: Active » Needs review
brendoncrawford’s picture

Status: Needs review » Closed (fixed)

cluke009. Patch from #5 has been applied. Thanks for your help. Should be available in dev release.

brendoncrawford’s picture

Status: Closed (fixed) » Fixed
bartezz’s picture

Status: Fixed » Active

Just downloaded dev but that's containing the old patch for CAPTCHA?

thesame-’s picture

It's the old one, because patxh #5 patched the old patch. ;)
It works great, but the way image is generated has changed. It should be like this:

        // Generate image source URL (add timestamp to avoid problems with
        // client side caching: subsequent images of the same CAPTCHA session
        // have the same URL, but should display a different code).
        $img_src = check_url(url("image_captcha/$captcha_sid/". time()));
        $query = '<img src="'. $img_src .'" alt="'. t('Image CAPTCHA') .'" title="'. t('Image CAPTCHA') .'" />';
        // build the result to return
        $result = array();
        $result['solution'] = $code;
dr.user’s picture

#5 not working with Ajax Register module.