mirror of
https://github.com/Such-Software/such.software.git
synced 2026-10-18 05:41:26 +02:00
feat: add resend for email
fix: nebual minified react error
This commit is contained in:
@@ -1,18 +1,41 @@
|
||||
'use client';
|
||||
import { Turnstile } from '@marsidev/react-turnstile';
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
const SITE_KEY = process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY;
|
||||
|
||||
export function TurnstileWidget({ onVerify }: { onVerify: (token: string) => void }) {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [error, setError] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
if (!SITE_KEY) {
|
||||
console.warn('NEXT_PUBLIC_TURNSTILE_SITE_KEY is not set');
|
||||
return null;
|
||||
}
|
||||
|
||||
// Only render on client after mount to avoid hydration issues
|
||||
if (!mounted) {
|
||||
return <div className="h-[65px] w-[300px]" />;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="text-xs text-muted-foreground">
|
||||
Security check unavailable
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Turnstile
|
||||
siteKey={SITE_KEY}
|
||||
onSuccess={onVerify}
|
||||
onError={() => setError(true)}
|
||||
onExpire={() => onVerify('')}
|
||||
options={{ theme: 'auto' }}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user