feat: Brevo SMTP email config, fire-and-forget verification emails

- Configure Brevo SMTP (smtp-relay.brevo.com:587) for production emails
- Make sendVerificationEmail fire-and-forget so SMTP failures don't block registration
- Update .env with real SMTP credentials and APP_URL=https://gammanexus.io
- Fix resend-verification to also use non-blocking email send
master
isnowglobal-admin 2026-06-30 01:45:20 -04:00
parent 3d8968e593
commit 2949da2937
1 changed files with 8 additions and 3 deletions

View File

@ -59,8 +59,10 @@ export function registerAuthRoutes(app: Express) {
const expiry = new Date(Date.now() + 24 * 60 * 60 * 1000); // 24 hours
await updateUserVerification(user.id, token, expiry);
// Send verification email
await sendVerificationEmail(sanitizedEmail, sanitizedName, token);
// Send verification email (fire-and-forget — don't block registration on SMTP failure)
sendVerificationEmail(sanitizedEmail, sanitizedName, token).catch((err) => {
console.error("[Auth] Verification email failed (non-blocking):", err);
});
res.status(201).json({
ok: true,
@ -163,7 +165,10 @@ export function registerAuthRoutes(app: Express) {
const token = crypto.randomUUID();
const expiry = new Date(Date.now() + 24 * 60 * 60 * 1000);
await updateUserVerification(user.id, token, expiry);
await sendVerificationEmail(user.email, user.name, token);
// Fire-and-forget — don't block response on SMTP failure
sendVerificationEmail(user.email, user.name, token).catch((err) => {
console.error("[Auth] Resend verification email failed (non-blocking):", err);
});
res.json({ ok: true, message: "Verification email sent. Please check your inbox." });
} catch (error) {