When logging is enabled, I always get

user_register post blocked by CAPTCHA module: challenge "reCAPTCHA" (by module "recaptcha"), user answered "reCAPTCHA", but the solution was "1".

It should look like

user_register post blocked by CAPTCHA module: challenge "reCAPTCHA" (by module "recaptcha"), user answered "un fctory" but the solution was "fun factory".

Comments

Kronix’s picture

I'm getting this as well. I don't suppose anyone has looked into this...?

It seems to be just a reporting error -- the reCAPTCHA is being validated correctly. But it would be helpful to determine how many invalid attempts are from actual users, and how many are from spammers.

jtwalters’s picture

I am pretty sure this isn't possible.

First of all, one of the words in the reCAPTCHA is unknown. The other (known) word, is inaccessible via the API (from what I can tell). At best, you could display an error message with the user's input without the actual solution.

fizk’s picture

I agree with jtwalters.

jerdiggity’s picture

Possible solution:
I just tested this and it appears as though it works, except it involves a change to the captcha.module file (maybe I'll create a patch and see if the maintainer[s] of captcha would be willing to implement it):

Starting at line 590 of captcha.module:

      if (variable_get('captcha_log_wrong_responses', FALSE)) {
        if (module_exists('recaptcha')) {
          $recaptcha_img_base = 'http://www.google.com/recaptcha/api/image?c=';
          $recaptcha_img_path = check_plain($_POST['recaptcha_challenge_field']);
          $recaptcha_response = check_plain($_POST['recaptcha_response_field']);
          $recaptcha_challenge_img = $recaptcha_img_base . $recaptcha_img_path;
          $recaptcha_img_to_html = "<img src=\"$recaptcha_challenge_img\" alt=\"reCAPTCHA challenge\" />";
          watchdog('CAPTCHA',
            "%form_id post blocked by CAPTCHA module: challenge '%challenge' (by module '%module'), user answered '%response', but the solution was $recaptcha_img_to_html",
            array('%form_id' => $form_id,
            '%response' => $recaptcha_response,
            '%challenge' => $captcha_info['captcha_type'], '%module' => $captcha_info['module'],
          ),
          WATCHDOG_NOTICE
        );
        }
        else { // EXISTING CODE:
        watchdog('CAPTCHA',
          '%form_id post blocked by CAPTCHA module: challenge "%challenge" (by module "%module"), user answered "%response", but the solution was "%solution".',
          array('%form_id' => $form_id,
            '%response' => $captcha_response, '%solution' => $solution,
            '%challenge' => $captcha_info['captcha_type'], '%module' => $captcha_info['module'],
          ),
          WATCHDOG_NOTICE
        );
        }
      }

*Note: using the %solution placeholder for $recaptcha_img_to_html will encode the html rendered by $recaptcha_img_to_html, causing it not to show up as the original reCAPTCHA image.

Thoughts/feedback?

hass’s picture

Project: reCAPTCHA » CAPTCHA
Version: 6.x-1.4 » 6.x-2.x-dev
Component: reCAPTCHA Captcha » Code
Issue summary: View changes

Moving to captcha module.

wundo’s picture

Status: Active » Closed (outdated)