From e1c4fb574421a7ed57fb947337e797be8bc12b33 Mon Sep 17 00:00:00 2001 From: lila Date: Sat, 2 May 2026 11:22:54 +0200 Subject: [PATCH] refactoring --- apps/api/src/lib/auth.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/api/src/lib/auth.ts b/apps/api/src/lib/auth.ts index eef78c3..16fe5d0 100644 --- a/apps/api/src/lib/auth.ts +++ b/apps/api/src/lib/auth.ts @@ -23,7 +23,13 @@ export const auth = betterAuth({ emailAndPassword: { enabled: true, requireEmailVerification: true, - sendResetPassword: async ({ user, url }) => { + sendResetPassword: async ({ + user, + url, + }: { + user: { email: string }; + url: string; + }) => { await resend.emails.send({ from: emailFrom, to: user.email, @@ -33,7 +39,16 @@ export const auth = betterAuth({ }, }, emailVerification: { - sendVerificationEmail: async ({ user, url }) => { + sendOnSignUp: true, + autoSignInAfterVerification: true, + sendVerificationEmail: async ({ + user, + url, + }: { + user: { email: string }; + url: string; + }) => { + console.log("Sending verification email to", user.email, url); await resend.emails.send({ from: emailFrom, to: user.email, @@ -41,8 +56,6 @@ export const auth = betterAuth({ html: `

Click here to verify your email address.

`, }); }, - sendOnSignUp: true, - autoSignInAfterVerification: true, }, trustedOrigins: [process.env["CORS_ORIGIN"] || "http://localhost:5173"], socialProviders: {