'use client' import { useState } from 'react' import { useTranslations, useLocale } from 'next-intl' import { Turnstile } from '@/components/Turnstile' import { EMAIL_RE } from '@/lib/bnet' const ERROR_KEYS = ['invalidCredentials', 'missingFields', 'invalidRequest', 'captchaFailed', 'notAnEmail'] as const export function LoginForm() { const t = useTranslations('Login') const locale = useLocale() const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [showPw, setShowPw] = useState(false) const [busy, setBusy] = useState(false) const [captcha, setCaptcha] = useState('') const [captchaKey, setCaptchaKey] = useState(0) // remonta el widget para pedir un token nuevo const [message, setMessage] = useState<{ ok: boolean; text: string } | null>(null) async function handleSubmit(e: React.FormEvent) { e.preventDefault() if (busy) return if (!email.trim() || !password) { setMessage({ ok: false, text: t('missingFields') }) return } // El