| Did you know ... | Search Documentation: |
| recaptcha.pl -- Add reCAPTCHA functionality to a form |
This module is a plugin for the SWI-Prolog HTTP/HTML framework to add reCAPTCHA functionality to a form. It works as follows:
method('POST') and include,
in addition to the data you request from the human user,
the reCAPTCHA widget using e.g.,
\recaptcha([theme(red)])
process_recaptcha_form(Request) :-
recaptcha_parameters(RecapthaParams),
http_parameters(Recaptha,
[ name(Name, []),
age(Age, []),
...
| RecapthaParams
]),
( recaptcha_verify(Request, RecapthaParams)
-> <process normal user fields>
; <you are not human>
).
recaptcha(+Options)// is detclean.
recaptcha_parameters(-List) is det
recaptcha_verify(+Request, +Parameters) is semidet
key(+Which, -Key) is det[multifile]public and to the reCAPTCHA private key if Which is private.
We leave the key handling to a hook to accomodate different ways for storing and transferring the keys. A simple implementation is:
:- use_module(library(http/recaptcha)). :- multifile recaptcha:key/2. recaptcha:key(public, 'Public key goes here'). recaptcha:key(private, 'Private key goes here').
When missing, a reserved test key pair is used.