P4: 审查收尾 - 第三方验证码闭环/导航指向/验证码统一校验
This commit is contained in:
@@ -20,7 +20,7 @@ export default function Login() {
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [capRequired, setCapRequired] = useState(false);
|
||||
const [capDone, setCapDone] = useState(false);
|
||||
const [capProof, setCapProof] = useState('');
|
||||
const [capResult, setCapResult] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (getToken()) { navigate('/', { replace: true }); return; }
|
||||
@@ -30,8 +30,8 @@ export default function Login() {
|
||||
}, [navigate]);
|
||||
|
||||
const doCaptcha = async () => {
|
||||
const proof = await showCaptcha('login');
|
||||
if (proof) { setCapProof(proof); setCapDone(true); }
|
||||
const result = await showCaptcha('login');
|
||||
if (result) { setCapResult(result); setCapDone(true); }
|
||||
};
|
||||
|
||||
const handleLogin = async () => {
|
||||
@@ -40,7 +40,7 @@ export default function Login() {
|
||||
setError('');
|
||||
setBusy(true);
|
||||
try {
|
||||
const data = await authApi.login(username.trim(), password, capProof || undefined);
|
||||
const data = await authApi.login(username.trim(), password, capResult || undefined);
|
||||
setToken(data.token);
|
||||
notifyAuthChange();
|
||||
const from = location.state && location.state.from;
|
||||
|
||||
Reference in New Issue
Block a user