11'use client'
22
3- import { useMemo , useRef , useState } from 'react'
4- import { Turnstile , type TurnstileInstance } from '@marsidev/react-turnstile'
3+ import { useRef , useState } from 'react'
54import { createLogger } from '@sim/logger'
65import { Eye , EyeOff } from 'lucide-react'
76import Link from 'next/link'
@@ -88,8 +87,6 @@ export default function LoginPage({
8887 const [ passwordErrors , setPasswordErrors ] = useState < string [ ] > ( [ ] )
8988 const [ showValidationError , setShowValidationError ] = useState ( false )
9089 const [ formError , setFormError ] = useState < string | null > ( null )
91- const turnstileRef = useRef < TurnstileInstance > ( null )
92- const turnstileSiteKey = useMemo ( ( ) => getEnv ( 'NEXT_PUBLIC_TURNSTILE_SITE_KEY' ) , [ ] )
9390 const buttonClass = useBrandedButtonClass ( )
9491
9592 const callbackUrlParam = searchParams ?. get ( 'callbackUrl' )
@@ -169,20 +166,6 @@ export default function LoginPage({
169166 const safeCallbackUrl = callbackUrl
170167 let errorHandled = false
171168
172- // Execute Turnstile challenge on submit and get a fresh token
173- let token : string | undefined
174- if ( turnstileSiteKey && turnstileRef . current ) {
175- try {
176- turnstileRef . current . reset ( )
177- turnstileRef . current . execute ( )
178- token = await turnstileRef . current . getResponsePromise ( 15_000 )
179- } catch {
180- setFormError ( 'Captcha verification failed. Please try again.' )
181- setIsLoading ( false )
182- return
183- }
184- }
185-
186169 setFormError ( null )
187170 const result = await client . signIn . email (
188171 {
@@ -191,11 +174,6 @@ export default function LoginPage({
191174 callbackURL : safeCallbackUrl ,
192175 } ,
193176 {
194- fetchOptions : {
195- headers : {
196- ...( token ? { 'x-captcha-response' : token } : { } ) ,
197- } ,
198- } ,
199177 onError : ( ctx ) => {
200178 logger . error ( 'Login error:' , ctx . error )
201179
@@ -464,16 +442,6 @@ export default function LoginPage({
464442 </ div >
465443 </ div >
466444
467- { turnstileSiteKey && (
468- < div className = 'absolute' >
469- < Turnstile
470- ref = { turnstileRef }
471- siteKey = { turnstileSiteKey }
472- options = { { size : 'invisible' , execution : 'execute' } }
473- />
474- </ div >
475- ) }
476-
477445 { resetSuccessMessage && (
478446 < div className = 'text-[#4CAF50] text-xs' >
479447 < p > { resetSuccessMessage } </ p >
0 commit comments