修改两步验证界面逻辑

This commit is contained in:
whyour 2021-12-25 20:09:02 +08:00
parent 58cd05fd09
commit fa6dec969f

View File

@ -113,6 +113,14 @@ const Login = () => {
}
};
const codeInputChange = (e: React.ChangeEvent) => {
const { value } = e.target as any;
const regx = /^[0-9]{6}$/;
if (regx.test(value)) {
completeTowFactor({ code: value });
}
};
useEffect(() => {
const isAuth = localStorage.getItem(config.authKey);
if (isAuth) {
@ -144,12 +152,15 @@ const Login = () => {
{
pattern: /^[0-9]{6}$/,
message: '验证码为6位数字',
validateTrigger: 'onBlur',
},
]}
hasFeedback
>
<Input placeholder="6位数字" autoFocus autoComplete="off" />
<Input
placeholder="6位数字"
onChange={codeInputChange}
autoFocus
autoComplete="off"
/>
</FormItem>
<Button
type="primary"