// Tela: Auth (login / cadastro / esqueci a senha) const { useState: useStateAuth } = React; function Auth({ t, lang, setLang, mode = 'signin', onAuth, onBack, onToggle, onForgot }) { const [email, setEmail] = useStateAuth(''); const [password, setPassword] = useStateAuth(''); const [name, setName] = useStateAuth(''); const [err, setErr] = useStateAuth(''); const [loading, setLoading] = useStateAuth(false); const [showPw, setShowPw] = useStateAuth(false); const isSignup = mode === 'signup'; async function submit(e) { e.preventDefault(); setErr(''); setLoading(true); try { const res = isSignup ? await window.DB.signUp({ email, password, name }) : await window.DB.signIn({ email, password }); onAuth(res); } catch (e) { setErr(e.message || 'Erro ao autenticar.'); } finally { setLoading(false); } } return (
{isSignup ? t.auth_have : t.auth_no} {' '}
{t.auth_terms} {t.nav_terms} · {t.nav_privacy}
{sent ? t.forgot_sent_sub : t.forgot_sub}