Captcha interface
| Project: | CAPTCHA |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | arnabdotorg |
| Status: | closed |
The attached patch provides the Captcha module with a two-part interface to other modules.
First, it defines two functions that other modules can call to present a captcha challenge. (For example, I have written an input filter module that encodes email addresses to protect them from spam harvesters; using this interface, it can present a captcha challenge before revealing the email address.) This interface consists of two functions: captcha_form(), which generates form items for the challenge, and captcha_test(), which tests the user's response.
Second, it defines a hook interface so that other modules can implement different captcha tests. (At present, the administrator selects which available test to use; in the future, this could be extended to, for example, permit visually impaired users to choose an alternative to the default image recognition challenge.) As an example, I have converted the arithmetic test from an earlier version of captcha.module into a captcha plug-in.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| captcha-api.patch | 8.78 KB | Ignored | None | None |

#1
Attached to this comment is an example of a module that uses the captcha interface defined in the above patch. This module encodes email addresses to protect them from spam harvesting. [Note: this example module is a work in progress.]
#2
Attached to this comment is a sample module that uses the hook interface defined in the patch above. This module is a plug-in captcha test that asks a simple arithmetic question; this makes the captcha module usable on systems without the GD image library. (This code is derived from an earlier version of captcha.module.)
#3
Will be working on this for 4.7 onwards.
#4
I've added this functionality to the cvs version, pl. test and confirm.
#5