Skip to content

msyrus/No-Captcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

No-Captcha

No-Captcha is a Node implementation for Google No Captcha reCaptcha

Installation

$ npm install no-captcha

Usage

var NoCaptcha = require('no-captcha');
noCaptcha = new NoCaptcha(PUBLIC_KEY,PRIVATE_KEY);

You can also pass a therd boolean parameter to specify the verifying url is secured or not. default if false

For No Captcha reCaptcha field in form

noCaptcha.toHTML()

You can also pass an optional option object to toHTML() method

  • onload method name to call after loading CAPTCHA
  • render explicit | onload
  • hl Language code
  • theme dark | light default 'light'
  • type text | audio default 'text'
  • size normal | compact default 'normal'
  • tabindex default 0
  • callback callback method name that's executed when the user submits a successful CAPTCHA response.
  • expired-callback callback method name that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA.

To verify

data = {
	response: req.body['g-recaptcha-response'],
	remoteip: req.connection.remoteAddress			// Optional
};

noCaptcha.verify(data, function(err, resp){
	if(err === null){
		res.send('Valid '+JSON.stringify(resp));
	}
});

Example

Here is an Iced Coffee Script, Jade, Express example

License

No-Captcha is available under the BSD (2-Clause) License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published