Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
recaptcha-v2
Advanced tools
node-recaptcha renders and verifies reCAPTCHA captchas.
NOTE: This release uses the latest v2 [reCAPTCHA] (http://www.google.com/recaptcha)
Via git:
$ git clone git://github.com/mrpetef10/node-recaptcha-v2.git ~/.node_libraries/node-recaptcha-v2
Via npm:
$ npm install recaptcha-v2
Before you can use this module, you must visit [reCAPTCHA] (http://www.google.com/recaptcha) to request a public and private API key for your domain.
app.js:
var express = require('express'),
Recaptcha = require('recaptcha').Recaptcha;
var PUBLIC_KEY = 'YOUR_PUBLIC_KEY',
PRIVATE_KEY = 'YOUR_PRIVATE_KEY';
var app = express.createServer();
app.configure(function() {
app.use(express.bodyParser());
});
app.get('/', function(req, res) {
var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY);
res.render('form.jade', {
layout: false,
locals: {
recaptcha_form: recaptcha.toHTML()
}
});
});
app.post('/', function(req, res) {
var data = {
remoteip: req.connection.remoteAddress,
response: req.param("g-recaptcha-response"),
secret: PRIVATE_KEY
};
var recaptcha = new Recaptcha(PUBLIC_KEY, PRIVATE_KEY, data);
recaptcha.verify(function(success, error_code) {
if (success) {
res.send('Recaptcha response valid.');
}
else {
// Redisplay the form.
res.render('form.jade', {
layout: false,
locals: {
recaptcha_form: recaptcha.toHTML()
}
});
}
});
});
app.listen(3000);
views/form.jade:
form(method='POST', action='.')
!= recaptcha_form
input(type='submit', value='Check Recaptcha')
Make sure express and jade are installed, then:
$ node app.js
FAQs
Obtain a v2 reCAPTCHA form and verify it
The npm package recaptcha-v2 receives a total of 344 weekly downloads. As such, recaptcha-v2 popularity was classified as not popular.
We found that recaptcha-v2 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.