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: {