diff --git a/web/src/components/common/captcha/index.tsx b/web/src/components/common/captcha/index.tsx index 88a9b3a..174df66 100644 --- a/web/src/components/common/captcha/index.tsx +++ b/web/src/components/common/captcha/index.tsx @@ -15,6 +15,7 @@ export type CaptchaProps = { url?: string; onSuccess: (token: string) => void; onError: (error: string) => void; + onAbort?: () => void; }; export function ReCaptchaWidget(props: CaptchaProps) { diff --git a/web/src/components/common/captcha/turnstile.tsx b/web/src/components/common/captcha/turnstile.tsx index c6be410..dc3b4a6 100644 --- a/web/src/components/common/captcha/turnstile.tsx +++ b/web/src/components/common/captcha/turnstile.tsx @@ -1,7 +1,9 @@ -import { useState } from "react"; +import { useEffect, useState } from "react"; import { CaptchaProps } from "."; import { Turnstile } from "@marsidev/react-turnstile"; import { useTranslations } from "next-intl"; + +const TURNSTILE_TIMEOUT = 15 // 简单的转圈圈动画 function Spinner() { return ( @@ -39,14 +41,14 @@ function ErrorMark() { export function OfficialTurnstileWidget(props: CaptchaProps) { return