diff --git a/src/lib/auth.ts b/src/lib/auth.ts index c375149..f989548 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -13,10 +13,10 @@ export const auth = betterAuth({ }), emailVerification: { sendOnSignUp: true, - sendVerificationEmail: async ({ user, url }) => { + sendVerificationEmail: async ({ user, token }) => { void sendVerificationEmail({ email: user.email, - verificationUrl: url + token }); } }, diff --git a/src/lib/server/email-verification.ts b/src/lib/server/email-verification.ts index 0e74479..2549149 100644 --- a/src/lib/server/email-verification.ts +++ b/src/lib/server/email-verification.ts @@ -1,15 +1,18 @@ +import { BASE_URL } from '$env/static/private'; import { sendMail } from './resend'; export async function sendVerificationEmail(options: { email: string; - verificationUrl: string; + token: string; }) { + const verificationUrl = `${BASE_URL}/api/auth/verify-email?token=${options.token}&callbackURL=/login`; + await sendMail({ to: options.email, templateId: 'email-verification-email', data: { target_email_address: options.email, - verification_link: options.verificationUrl + verification_link: verificationUrl } }); }