Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
easy-react-captcha-code
Advanced tools
基于 react-captcha-code
进行二次开发。依赖于react-captcha-code
。
npm install react-captcha-code-custom --save
同级依赖:
依赖名称 | 版本 |
---|---|
| react | ^16.13.1 | |
| react-dom | ^16.13.1 | |
名称 | 类型 | 是否必填 | 默认值 | 描述 |
---|---|---|---|---|
height | number | 否 | 40 | 验证码的高度 |
width | number | 否 | 100 | 验证码的宽度 |
bgColor | string | 否 | #DFF0D8 | 背景颜色 |
charNum | number | 否 | 4 | 字符个数 |
fontSize | number | 否 | 25 | 字体大小 |
code | string | 否 | 要展示的验证码(受控) | |
onChange | (captcha: string) => void | 否 | 点击验证码的回调函数, 用来传递验证码(会在页面初始加载和点击验证码时调用) | |
onClick | () => void | 否 | 点击验证码的回调函数 | |
onRef | (ref: any) => void | 否 | 不推荐使用,推荐使用下面的 ref 获取刷新接口 | |
ref | - | 否 | 推荐使用 ref 获取刷新接口canvasRef.current.refresh() 组件内部通过过useImperativeHandle 暴露 refresh 接口 | |
className | string | 否 | 样式名 |
import React, { useCallback, useRef } from 'react';
import Captcha from 'react-captcha-code-custom';
export const Basic = () => {
const handleChange = useCallback((captcha) => {
console.log('captcha:', captcha);
}, []);
const captchaRef = useRef<HTMLCanvasElement>();
const handleClick = () => {
// 刷新验证码
(captchaRef as any).current.refresh();
};
return (
<>
<Captcha ref={captchaRef} charNum={6} onChange={handleChange} />
<div>
<button onClick={handleClick}>更换验证码</button>
</div>
</>
);
};
FAQs
基于React和canvas的验证码
The npm package easy-react-captcha-code receives a total of 1 weekly downloads. As such, easy-react-captcha-code popularity was classified as not popular.
We found that easy-react-captcha-code 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.