[GMG-Devel] CAPTCHA framework for your consideration
As some of you may know, I cobbled together a Google reCAPTCHA plugin a
while back. My reCAPTCHA solution was far from optimal. I basically
reimplemented the entire basic_auth plugin with customized views just so
I could add a bit of CAPTCHA code to a page and receive POST data back.
And the reCAPTCHA plugin couldn't be run alongside the basic_auth
plugin; to ensure that the CAPTCHA view showed properly, you had to
disable the basic_auth plugin.
In the months since my first CAPTCHA attempt, I've been thinking a lot
about how to recreate my plugin in a more efficient way. Rather than
replacing the basic_auth plugin, it should supplement the basic_auth
plugin with only the CAPTCHA code. I think I've finally found a way to
make that happen that makes sense in a MediaGoblin sort of way, and I'd
like to present that for your consideration.
I. Basic Needs
In my mind, a CAPTCHA plugin needs to perform two main functions. First,
it should display a CAPTCHA challenge on the appropriate view(s).
Second, it should provide a mechanism of validating the CAPTCHA
response, which probably requires analyzing some POST data of a form.
II. Hook it up
In the world of Gnu MediaGoblin, we seem to handle this kind of stuff
with hooks. A simple template_hook should suffice for the function of
displaying a CAPTCHA challenge. To that end, I propose we add a
"captcha_challenge" template hook which can be placed wherever
appropriate. For a specific example, I would suggest adding it to the
register view , which would appear something like .