Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
recaptcha-verify
Advanced tools
Readme
Implements Google's reCAPTCHA in node.js. It can be used with pure node.js or in combination with express.js. Doesn't require additional libraries, just core http
module.
$ npm install --save recaptcha-verify
Use the site key to display the widget in the page (inside a form). For a more info on how to display the widget, see the documentation.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document title</title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<form action="/nodeform">
<input type="text"/>
<input type="text"/>
<div class="g-recaptcha" data-sitekey="SITE_KEY"></div>
<input type="submit">
</form>
</body>
</html>
In node we must use the secret key.
Options object have 2 keys:
Callback returns an error when something is wrong. The response object is described in the documentation.
var Recaptcha = require('recaptcha-verify');
var recaptcha = new Recaptcha({
secret: 'SECRET_KEY',
verbose: true
});
app.get('/check', function(req, res){
// get the user response (from reCAPTCHA)
var userResponse = req.query['g-recaptcha-response'];
recaptcha.checkResponse(userResponse, function(error, response){
if(error){
// an internal error?
res.status(400).render('400', {
message: error.toString()
});
return;
}
if(response.success){
res.status(200).send('the user is a HUMAN :)');
// save session.. create user.. save form data.. render page, return json.. etc.
}else{
res.status(200).send('the user is a ROBOT :(');
// show warning, render page, return a json, etc.
}
});
});
For more information, please check out https://github.com/AlejandroSilva or send me and email to pm5k.sk[at]gmail.com
FAQs
a generic recaptcha validator
The npm package recaptcha-verify receives a total of 739 weekly downloads. As such, recaptcha-verify popularity was classified as not popular.
We found that recaptcha-verify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.