Drupal caches pages for anonumous users.
Anonumous users require CAPTCHA more than others. When the same page was loaded for the second, third, etc. time another captcha image is generated but it is not displayed because page was cached by Drupal.
Easy to reproduce: just enable CAPTCHA for registration page, click create a new account and then press F5 several times. This happens because [base URL]?q=user/register record is in the cache table. If you remove it and refresh the page a new captcha image will be displayed correctly.
How can this problem be resolved ? May be it is better to create a file with CAPTCHA image but not generate it through menu callback function ?
Thanks.
Comments
Comment #1
luperry commentedhmm... I'm expericing the same issue.
Comment #2
m3avrck commentedCaptcha module needs to define a hook_init() so it can clear the user/register cache in those cases. Code would be as follows:
Comment #3
ardas commentedThanks for the patch but it doesn't work for me. May be I'm doing anything wrong ...
After I added this code to captcha module I still didn't work, but after I added drupal_set_message() call it began to work .....
I also tried to move the code into captcha_menu() - the result is the same.
Comment #4
ardas commentedDear captcha authors,
Is there any proper fix of this issue ? Are there any abilities to turn on/off caching on a page basis ?
Comment #5
luperry commentedhere is my workaround to the problem. first I used the cache exclusion hack mentioned here: http://drupal.org/node/23797#comment-75367
then I made the following modifications to textimage.module:
change
to
change
to
basically, the workaround uses a fixed url on all the pages, but it makes the image dynamic. not a pretty fix, since you need to hack the drupal core, but it works great. if someone comes up with a better solution, I would love to hear it.
Comment #6
joepublicster commentedThe fix posted at http://drupal.org/node/23797#comment-157047 and http://drupal.org/node/23797#comment-163493 fixes this on 4.7.3
Comment #7
wundo commented