Captcha and page caching

Events happening in the community are now at Drupal community events on www.drupal.org.
soxofaan's picture

As expected captcha does not play nice with page caching: the captcha system wants each form to have a different challenge. With the current implementation of captcha (and also my rewrite), when caching is enabled, each anonymous users gets the same challenge. Only the first user that requested the form will be able to successfully solve the captcha because the solution is in his session, all other users can't pass the captcha challenge.

We could do something like http://drupal.org/project/cacheexclude (or even depend on that module) and clear the page cache for each page with a form with a generated captcha on the hook_exit phase.

any thoughts on this?

Comments

Variables

heine's picture

When you add a captcha to a form, simply set $GLOBALS['conf']['cache']to FALSE (http://heine.familiedeelstra.com/new-math-captcha-for-drupal).

thanks

soxofaan's picture

Thanks a lot!
I knew there would be a such a simple solution for this.

for those interested in the matter: this also works:

<?php
global $conf;
$conf['cache'] = FALSE;
?>

Can I add above logic in template file

drupalfox's picture

Can I add the above logic inside template or I have to write module for it.

CAPTCHA

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: