refactoring
This commit is contained in:
parent
dc11213cb5
commit
e1c4fb5744
1 changed files with 17 additions and 4 deletions
|
|
@ -23,7 +23,13 @@ export const auth = betterAuth({
|
||||||
emailAndPassword: {
|
emailAndPassword: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
requireEmailVerification: true,
|
requireEmailVerification: true,
|
||||||
sendResetPassword: async ({ user, url }) => {
|
sendResetPassword: async ({
|
||||||
|
user,
|
||||||
|
url,
|
||||||
|
}: {
|
||||||
|
user: { email: string };
|
||||||
|
url: string;
|
||||||
|
}) => {
|
||||||
await resend.emails.send({
|
await resend.emails.send({
|
||||||
from: emailFrom,
|
from: emailFrom,
|
||||||
to: user.email,
|
to: user.email,
|
||||||
|
|
@ -33,7 +39,16 @@ export const auth = betterAuth({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emailVerification: {
|
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({
|
await resend.emails.send({
|
||||||
from: emailFrom,
|
from: emailFrom,
|
||||||
to: user.email,
|
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>`,
|
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"],
|
trustedOrigins: [process.env["CORS_ORIGIN"] || "http://localhost:5173"],
|
||||||
socialProviders: {
|
socialProviders: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue