Patch to allow caching on MyCaptcha forms

Hello,

I've created a simple patch that allows the Page Cache to work on forms that have a MyCaptcha. The trick is that we don't actually need to generate a new CAPTCHA on every page view -- the CAPTCHA only needs to update when someone attempts to answer it. So it allows the Page Cache to work, but it clears the page from the cache in the _validate function.

To make it work, I had to remove the session_id() component of the seed so everyone gets the same captcha. This isn't ideal, but it's not terrible either. It would be bad on a site that gets very heavy comment volume since it creates a bit of a race condition (if someone else answers the captcha after you've loaded the form, your answer will be rejected and you'll have to try again -- annoying, but not a deal breaker).

I've actually got an idea on how to solve that race condition (and elimate the cache_captcha table to boot) with some clever hashing and a timestamp. I may end up just forking my own version, if I ever get around to coding it.

Let me know if you want the patch -- eli (at) fiercemarkets (dot) com

Eli

No votes yet