bhanwarpsrathore/recaptcha

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (dev-master) of this package.

reCaptcha Plugin for cakephp 2

dev-master 2023-06-26 05:47 UTC

This package is auto-updated.

Last update: 2024-01-26 07:41:20 UTC


README

Description

reCAPTCHA is a free CAPTCHA service that protect websites from spam and abuse.

#Usage First, register keys for your site at here

Then,To use the recaptcha plugin its required to include the following two lines in your /app/Config/bootstrap.php file.

Configure::write('Recaptcha.publicKey', 'public-api-key');
Configure::write('Recaptcha.privateKey', 'private-api-key');

Controllers that will be using recaptcha require the Recaptcha Component to be included. Through inclusion of the component, the helper is automatically made available to your views.

public $components = array('Recaptcha.Recaptcha');

In the view simply call the helpers display() method to render the recaptcha input:

echo $this->Recaptcha->display();

To check the result simply do something like this in your controller:

if ($this->request->is('post')) {
    if ($this->Recaptcha->verify()) {
        // verified
    } else {
        // display the error
    }
}