download   home


matrixhasyou2k4@gmail.com's Gravatar   Jonathan Creamer Jan 23, 2011 at 3:44 PM May 24, 2012 at 4:51 AM 1.0 3.0.0 Plugins 904 165

Recaptcha

A Google Recaptcha plugin

Description

A plugin for rendering and validating a Google Recaptcha.


Have fun!

Installation Instructions

This plugin is compatible with CF9 as it is written in the new cfscript format, and is written for use in Coldbox. First off, place these in your settings in Coldbox.cfc:

			recaptcha_PublicKey = "YOUR KEY HERE",
			recaptcha_PrivateKey = "YOUR KEY HERE"
			
I initialize the Recaptcha plugin in the controller with:
rc.recaptcha = getPlugin("Recaptcha",true).init();
Then here in the view I simply render it by:
rc.recaptcha.render("clean","English")
Then I validate the code like so:
var rc.recaptcha = getPlugin("Recaptcha",true);
var responseVar = rc.recaptcha.checkAnswer(rc.recaptcha_challenge_field,
					rc.recaptcha_response_field);
if(responseVar[1])
{
	return true;
}
else
{
	return false;
}
			
There are several skins and languages to choose from. Also, it is neccessary to have a Recaptcha key from http://www.google.com/recaptcha. Then place the keys in the Coldbox.cfc settings struct like
recaptcha_PublicKey = "PlaceCodeHere",
recaptcha_PrivateKey = "PlaceCodeHere"
Enjoy!