Plugin for CMF Cotonti to protect your site from spam and abuse with a reCAPTCHA.
reCAPTCHA v2 is currently supported.
Authors: esclkm, Andrey Matsovkin, Kalnov Alexey
Plugin page: https://www.cotonti.com/extensions/security-authentication/recaptcha
- Unpack to your plugins folder
- Install the plugin in AdminCP
- Visit https://developers.google.com/recaptcha to obtain reCAPTCHA keys and get detailed info
- Configure the plugin (don't forget to add the keys!)
- Add tags to users.register.tpl:
{USERS_REGISTER_VERIFYIMG}
, to comments.tpl:{COMMENTS_FORM_VERIFY_IMG}
, to contact.tpl:{CONTACT_FORM_VERIFY_IMG}
Use this function to generate CAPTCHA in your extensions:
$t->assign([
'SOMETHING_CAPTCHA' => cot_captcha_generate(),
]);
Then check CAPTCHA on form processing:
$response = cot_import('g-recaptcha-response', 'P', 'TXT');
if (!cot_captcha_validate($response)) {
cot_error('recaptcha_verification_failed', 'response');
}