Would it be possible to allow API modules to decide if they want to be case sensitive or not.

My addon Riddler would benefit from that, mostly because it's either to implement this in Captcha or bypass the Captcha module all together. That would be a waste however.

Comments

soxofaan’s picture

There is an option to preprocess the given answer before validation. This not documented in the API however. Look for 'preprocess' (around line 331 and 384) in captcha.module. You should (in a nutshell):

  • Add a non false 'preprocess' entry in the array you return in the 'generate' part of your hook_captcha implementation
  • Add a 'process' operation in your hook_captcha implementation. Your hook_captcha function should also look like: hook_captcha($op, $captcha_type='', $answer='')
imerlin’s picture

Status: Active » Fixed

Added in the latest release, thanks.

soxofaan’s picture

in an effort to make the captcha API better, a minor thing changed to the preprocess API.
When the patch from http://drupal.org/node/158613#comment-288696 will be committed, the second step of #1 (http://drupal.org/node/160769#comment-277301) changes to:

  • Add a 'preprocess' operation in your hook_captcha implementation. Your hook_captcha function should also look like: hook_captcha($op, $captcha_type='', $answer='')

The preprocess is documented in the patch of http://drupal.org/node/158613#comment-288696 .

I changed it because 'process' seems to suggest to do the validation, while 'preprocess' is more intuitive.

Anonymous’s picture

Status: Fixed » Closed (fixed)