P4: 审查收尾 - 第三方验证码闭环/导航指向/验证码统一校验

This commit is contained in:
2026-08-06 23:01:52 +08:00
parent 72295ded4d
commit f7dd4163b2
9 changed files with 117 additions and 56 deletions
+4 -4
View File
@@ -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;