
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-recaptcha
Advanced tools
A react.js reCAPTCHA for Google. The FREE anti-abuse service. Easy to add, advanced security, accessible to wide range of users and platforms.
reCAPTCHA is a free service that protects your site from spam and abuse. It uses advanced risk analysis engine to tell humans and bots apart. With the new API, a significant number of your valid human users will pass the reCAPTCHA challenge without having to solve a CAPTCHA (See blog for more details). reCAPTCHA comes in the form of a widget that you can easily add to your blog, forum, registration form, etc.
See the details.
To use reCAPTCHA, you need to sign up for an API key pair for your site. The key pair consists of a site key and secret. The site key is used to display the widget on your site. The secret authorizes communication between your application backend and the reCAPTCHA server to verify the user's response. The secret needs to be kept safe for security purposes.
Install package via node.js
$ npm install --save react-recaptcha
You can see the full example by follwing steps.
$ npm install
$ npm start
open the http://localhost:3000
in your browser.
Html example code:
<html>
<head>
<title>reCAPTCHA demo: Simple page</title>
<script src="build/react.js"></script>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<div id="example"></div>
<script src="build/index.js"></script>
</body>
</html>
Jsx example code: build/index.js
var Recaptcha = require('react-recaptcha');
ReactDOM.render(
<Recaptcha
sitekey="xxxxxxxxxxxxxxxxxxxx"
/>,
document.getElementById('example')
);
Deferring the render can be achieved by specifying your onload callback function and adding parameters to the JavaScript resource.
<html>
<head>
<title>reCAPTCHA demo: Simple page</title>
<script src="build/react.js"></script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" async defer></script>
</head>
<body>
<div id="example"></div>
<script src="build/index.js"></script>
</body>
</html>
Jsx example code: build/index.js
var Recaptcha = require('react-recaptcha');
// specifying your onload callback function
var callback = function () {
console.log('Done!!!!');
};
ReactDOM.render(
<Recaptcha
sitekey="xxxxxxxxxxxxxxxxxxxx"
render="explicit"
onloadCallback={callback}
/>,
document.getElementById('example')
);
Define verify Callback function
var Recaptcha = require('react-recaptcha');
// specifying your onload callback function
var callback = function () {
console.log('Done!!!!');
};
// specifying verify callback function
var verifyCallback = function (response) {
console.log(response);
};
ReactDOM.render(
<Recaptcha
sitekey="xxxxxxxxxxxxxxxxxxxx"
render="explicit"
verifyCallback={verifyCallback}
onloadCallback={callback}
/>,
document.getElementById('example')
);
Change the color theme of the widget. Please theme
property light|dark
. Default value is light
.
ReactDOM.render(
<Recaptcha
sitekey="xxxxxxxxxxxxxxxxxxxx"
theme="dark"
/>,
document.getElementById('example')
);
Change the type of CAPTCHA to serve. Please type
property audio|image
. Default value is image
.
ReactDOM.render(
<Recaptcha
sitekey="xxxxxxxxxxxxxxxxxxxx"
type="audio"
/>,
document.getElementById('example')
);
FAQs
A react.js reCAPTCHA for Google
The npm package react-recaptcha receives a total of 15,625 weekly downloads. As such, react-recaptcha popularity was classified as popular.
We found that react-recaptcha 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.