Skip to content

Cotonti-Extensions/recaptcha

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

reCAPTCHA

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

Installation

  • 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}

Developers API

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');
}

Example: Снимок экрана 2023-08-22 142809

Releases

No releases published

Packages

No packages published

Languages

  • PHP 97.9%
  • HTML 2.1%