refactoring

This commit is contained in:
lila 2026-05-02 11:22:54 +02:00
parent dc11213cb5
commit e1c4fb5744

View file

@ -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: `<p>Click <a href="${url}">here</a> to verify your email address.</p>`,
});
},
sendOnSignUp: true,
autoSignInAfterVerification: true,
},
trustedOrigins: [process.env["CORS_ORIGIN"] || "http://localhost:5173"],
socialProviders: {