Google reCAPTCHA is a service from Google that prevents bots (automated systems) from accessing your web application. Mosts bots are malicious in nature, and attempt to spam your site with links to products, or to test for potential exploits.
Moya Google Recaptcha is built in to Moya and may be imported from its Python path as follows:
And installed as follows:
This library's long name is
moya.google.recaptcha to reflect the fact that it is packaged by Moya, but the author is Google.
The XML namespace for this library is
http://moyaproject.com/recaptcha. The XML prefix is assumed to be
recaptcha: for the the examples in this document.
To use reCAPTCHA, you will need two keys; a site key which identifies the URL your web application will run on, and a secret key which is used when checking the user's response. You can get both keys by signing up.
This library has the following settings:
sitekey = <SITEKEY>
This should be your site key.
secretkey = <SECRETKEY>
This should be your secret key.
When the user fills in the CAPTCHA, it writes a reCAPTCHA response value called
g-recaptcha-response to the form (this name can not be changed). You can then check reCAPTCHA response with <verify>, which will return
True if the user is likely a human. This may done directly in the form with the following: