diff --git a/apps/dashboard/src/app/login/LoginPage.tsx b/apps/dashboard/src/app/login/LoginPage.tsx index f7f4f2a10d6..15ddc470a5e 100644 --- a/apps/dashboard/src/app/login/LoginPage.tsx +++ b/apps/dashboard/src/app/login/LoginPage.tsx @@ -19,6 +19,7 @@ import { } from "thirdweb/react"; import { createWallet, inAppWallet } from "thirdweb/wallets"; import { ClientOnly } from "../../components/ClientOnly/ClientOnly"; +import { isVercel } from "../../lib/vercel-utils"; import { ThirdwebMiniLogo } from "../components/ThirdwebMiniLogo"; import { getSDKTheme } from "../components/sdk-component-theme"; import { doLogin, doLogout, getLoginPayload, isLoggedIn } from "./auth-actions"; @@ -246,14 +247,17 @@ function CustomConnectEmbed(props: { }) { const { theme } = useTheme(); const client = useThirdwebClient(); - const [turnstileToken, setTurnstileToken] = useState(""); + const [turnstileToken, setTurnstileToken] = useState( + undefined, + ); + const [alwaysShowTurnstile, setAlwaysShowTurnstile] = useState(false); return (
{ + if (isVercel() && !turnstileToken) { + setAlwaysShowTurnstile(true); + throw new Error("Please complete the captcha."); + } + try { const result = await doLogin(params, turnstileToken); if (result.error) { diff --git a/apps/dashboard/src/app/login/auth-actions.ts b/apps/dashboard/src/app/login/auth-actions.ts index db2e15f6e6f..7b19a11f2e2 100644 --- a/apps/dashboard/src/app/login/auth-actions.ts +++ b/apps/dashboard/src/app/login/auth-actions.ts @@ -40,7 +40,7 @@ export async function getLoginPayload( export async function doLogin( payload: VerifyLoginPayloadParams, - turnstileToken: string, + turnstileToken: string | undefined, ) { if (!THIRDWEB_API_SECRET) { throw new Error("API_SERVER_SECRET is not set");