Explicitly resend verification email on unverified login

Better Auth does not auto-resend on 403 (verified against Resend logs),
so request a fresh link via authClient.sendVerificationEmail before
telling the user a new email was sent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 14:05:32 +05:00
parent 2790a7d24b
commit 85cf8be705
+3 -2
View File
@@ -23,8 +23,9 @@ export function LoginForm() {
if (result.error) { if (result.error) {
if (result.error.status === 403) { if (result.error.status === 403) {
// Креды верны, но email не подтверждён. Better Auth уже // Креды верны, но email не подтверждён. Better Auth сам письмо
// переотправил письмо подтверждения — сообщаем об этом. // не переотправляет (проверено) — запрашиваем свежую ссылку явно.
await authClient.sendVerificationEmail({ email, callbackURL: "/dashboard" });
setNeedsVerification(true); setNeedsVerification(true);
} else if (result.error.status === 429) { } else if (result.error.status === 429) {
setError("Слишком много попыток входа. Подождите минуту и попробуйте снова."); setError("Слишком много попыток входа. Подождите минуту и попробуйте снова.");