Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Latest commit

 

History

History
38 lines (28 loc) · 1.05 KB

README.md

File metadata and controls

38 lines (28 loc) · 1.05 KB

reCaptcha Plugin for cakephp 2

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