@@ -19,6 +19,7 @@ import {
1919} from "thirdweb/react" ;
2020import { createWallet , inAppWallet } from "thirdweb/wallets" ;
2121import { ClientOnly } from "../../components/ClientOnly/ClientOnly" ;
22+ import { isVercel } from "../../lib/vercel-utils" ;
2223import { ThirdwebMiniLogo } from "../components/ThirdwebMiniLogo" ;
2324import { getSDKTheme } from "../components/sdk-component-theme" ;
2425import { doLogin , doLogout , getLoginPayload , isLoggedIn } from "./auth-actions" ;
@@ -246,14 +247,17 @@ function CustomConnectEmbed(props: {
246247} ) {
247248 const { theme } = useTheme ( ) ;
248249 const client = useThirdwebClient ( ) ;
249- const [ turnstileToken , setTurnstileToken ] = useState ( "" ) ;
250+ const [ turnstileToken , setTurnstileToken ] = useState < string | undefined > (
251+ undefined ,
252+ ) ;
253+ const [ alwaysShowTurnstile , setAlwaysShowTurnstile ] = useState ( false ) ;
250254
251255 return (
252256 < div className = "flex flex-col items-center gap-4" >
253257 < Turnstile
254258 options = { {
255259 // only show if interaction is required
256- appearance : "interaction-only" ,
260+ appearance : alwaysShowTurnstile ? "always" : "interaction-only" ,
257261 // match the theme of the rest of the app
258262 theme : theme === "light" ? "light" : "dark" ,
259263 } }
@@ -265,6 +269,11 @@ function CustomConnectEmbed(props: {
265269 auth = { {
266270 getLoginPayload,
267271 doLogin : async ( params ) => {
272+ if ( isVercel ( ) && ! turnstileToken ) {
273+ setAlwaysShowTurnstile ( true ) ;
274+ throw new Error ( "Please complete the captcha." ) ;
275+ }
276+
268277 try {
269278 const result = await doLogin ( params , turnstileToken ) ;
270279 if ( result . error ) {
0 commit comments