From 43287a4baa021fdb388e84b78cb9ae6b29000d8d Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Wed, 3 Jun 2026 10:41:56 -0300 Subject: [PATCH] feat(emails): integrate email verification layout into auth email sending process --- .../src/emails/booking-confirmation.ts | 2 +- apps/backend/src/lib/auth.ts | 66 ++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/apps/backend/src/emails/booking-confirmation.ts b/apps/backend/src/emails/booking-confirmation.ts index 0ab1b9a..f0a4994 100644 --- a/apps/backend/src/emails/booking-confirmation.ts +++ b/apps/backend/src/emails/booking-confirmation.ts @@ -49,7 +49,7 @@ const BASE_STYLES = ` } `; -function wrapLayout(content: string) { +export function wrapLayout(content: string) { return ` diff --git a/apps/backend/src/lib/auth.ts b/apps/backend/src/lib/auth.ts index 240ce45..5c9b7e7 100644 --- a/apps/backend/src/lib/auth.ts +++ b/apps/backend/src/lib/auth.ts @@ -1,3 +1,4 @@ +import { wrapLayout } from '@/emails/booking-confirmation'; import { dash } from '@better-auth/infra'; import { betterAuth } from 'better-auth'; import { prismaAdapter } from 'better-auth/adapters/prisma'; @@ -34,10 +35,73 @@ export const auth = betterAuth({ const verificationUrl = new URL(url); const appUrl = process.env.APP_BASE_URL ?? 'http://localhost:5173'; verificationUrl.searchParams.set('callbackURL', appUrl); + + const content = ` + + + + + + + +
+ + + + +
+ Verificación de email +
+

+ Verificá tu dirección de correo electrónico +

+
+ + + + + +
+ Playzer + + Playzer +
+
+ + + + + +

+ Hacé click en el botón de abajo para verificar tu dirección de correo electrónico y empezar a usar Playzer. +

+ + + + + + + + + +
+ Verificar email +
+ + + + + +

+ Si no creaste una cuenta en Playzer, ignorá este mensaje. +

+ + `; + await sendMail({ to: user.email, subject: 'Verificá tu email en Playzer', - html: `Hacé click para verificar tu email: ${verificationUrl.toString()}`, + html: wrapLayout(content), text: `Hacé click para verificar tu email: ${verificationUrl.toString()}`, }); },