mirror of
https://github.com/shadcn-ui/taxonomy
synced 2026-05-24 09:48:32 +00:00
fix: remove email provider
This commit is contained in:
parent
3755313e1e
commit
30a8e85c82
1 changed files with 39 additions and 39 deletions
78
lib/auth.ts
78
lib/auth.ts
|
|
@ -26,48 +26,48 @@ export const authOptions: NextAuthOptions = {
|
|||
clientId: process.env.GITHUB_CLIENT_ID || "",
|
||||
clientSecret: process.env.GITHUB_CLIENT_SECRET || "",
|
||||
}),
|
||||
EmailProvider({
|
||||
from: process.env.SMTP_FROM,
|
||||
sendVerificationRequest: async ({ identifier, url, provider }) => {
|
||||
const user = await db.user.findUnique({
|
||||
where: {
|
||||
email: identifier,
|
||||
},
|
||||
select: {
|
||||
emailVerified: true,
|
||||
},
|
||||
})
|
||||
// EmailProvider({
|
||||
// from: process.env.SMTP_FROM,
|
||||
// sendVerificationRequest: async ({ identifier, url, provider }) => {
|
||||
// const user = await db.user.findUnique({
|
||||
// where: {
|
||||
// email: identifier,
|
||||
// },
|
||||
// select: {
|
||||
// emailVerified: true,
|
||||
// },
|
||||
// })
|
||||
|
||||
const templateId = user?.emailVerified
|
||||
? process.env.POSTMARK_SIGN_IN_TEMPLATE
|
||||
: process.env.POSTMARK_ACTIVATION_TEMPLATE
|
||||
if (!templateId) {
|
||||
throw new Error("Missing template id")
|
||||
}
|
||||
// const templateId = user?.emailVerified
|
||||
// ? process.env.POSTMARK_SIGN_IN_TEMPLATE
|
||||
// : process.env.POSTMARK_ACTIVATION_TEMPLATE
|
||||
// if (!templateId) {
|
||||
// throw new Error("Missing template id")
|
||||
// }
|
||||
|
||||
const result = await postmarkClient.sendEmailWithTemplate({
|
||||
TemplateId: parseInt(templateId),
|
||||
To: identifier,
|
||||
From: provider.from as string,
|
||||
TemplateModel: {
|
||||
action_url: url,
|
||||
product_name: siteConfig.name,
|
||||
},
|
||||
Headers: [
|
||||
{
|
||||
// Set this to prevent Gmail from threading emails.
|
||||
// See https://stackoverflow.com/questions/23434110/force-emails-not-to-be-grouped-into-conversations/25435722.
|
||||
Name: "X-Entity-Ref-ID",
|
||||
Value: new Date().getTime() + "",
|
||||
},
|
||||
],
|
||||
})
|
||||
// const result = await postmarkClient.sendEmailWithTemplate({
|
||||
// TemplateId: parseInt(templateId),
|
||||
// To: identifier,
|
||||
// From: provider.from as string,
|
||||
// TemplateModel: {
|
||||
// action_url: url,
|
||||
// product_name: siteConfig.name,
|
||||
// },
|
||||
// Headers: [
|
||||
// {
|
||||
// // Set this to prevent Gmail from threading emails.
|
||||
// // See https://stackoverflow.com/questions/23434110/force-emails-not-to-be-grouped-into-conversations/25435722.
|
||||
// Name: "X-Entity-Ref-ID",
|
||||
// Value: new Date().getTime() + "",
|
||||
// },
|
||||
// ],
|
||||
// })
|
||||
|
||||
if (result.ErrorCode) {
|
||||
throw new Error(result.Message)
|
||||
}
|
||||
},
|
||||
}),
|
||||
// if (result.ErrorCode) {
|
||||
// throw new Error(result.Message)
|
||||
// }
|
||||
// },
|
||||
// }),
|
||||
],
|
||||
// callbacks: {
|
||||
// async session({ token, session }) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue