mirror of
https://github.com/shadcn-ui/taxonomy
synced 2026-05-24 01:38:28 +00:00
refactor: remove unused postmark code
This commit is contained in:
parent
44e89d4ef4
commit
9c4461bcd7
2 changed files with 7 additions and 26 deletions
|
|
@ -21,16 +21,10 @@ DATABASE_URL="mysql://root:root@localhost:3306/taxonomy?schema=public"
|
|||
# -----------------------------------------------------------------------------
|
||||
# Email (Postmark)
|
||||
# -----------------------------------------------------------------------------
|
||||
SMTP_FROM=
|
||||
POSTMARK_API_TOKEN=
|
||||
POSTMARK_SIGN_IN_TEMPLATE=
|
||||
POSTMARK_ACTIVATION_TEMPLATE=
|
||||
SMTP_HOST=smtp.postmarkapp.com
|
||||
SMTP_PORT=25
|
||||
SMTP_USER=
|
||||
SMTP_PASSWORD=
|
||||
SMTP_FROM=
|
||||
const POSTMARK_SIGN_IN_TEMPLATE=
|
||||
const POSTMARK_ACTIVATION_TEMPLATE=
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Subscriptions (Stripe)
|
||||
|
|
|
|||
25
lib/auth.ts
25
lib/auth.ts
|
|
@ -5,16 +5,10 @@ import { PrismaAdapter } from "@next-auth/prisma-adapter"
|
|||
import { Client } from "postmark"
|
||||
|
||||
import { db } from "@/lib/db"
|
||||
import { siteConfig } from "@/config/site"
|
||||
|
||||
const postmarkClient = new Client(process.env.POSTMARK_API_TOKEN)
|
||||
|
||||
const POSTMARK_SIGN_IN_TEMPLATE = parseInt(
|
||||
process.env.POSTMARK_SIGN_IN_TEMPLATE
|
||||
)
|
||||
const POSTMARK_ACTIVATION_TEMPLATE = parseInt(
|
||||
process.env.POSTMARK_ACTIVATION_TEMPLATE
|
||||
)
|
||||
|
||||
export const authOptions: NextAuthOptions = {
|
||||
// huh any! I know.
|
||||
// This is a temporary fix for prisma client.
|
||||
|
|
@ -32,14 +26,6 @@ export const authOptions: NextAuthOptions = {
|
|||
clientSecret: process.env.GITHUB_CLIENT_SECRET,
|
||||
}),
|
||||
EmailProvider({
|
||||
server: {
|
||||
host: process.env.SMTP_HOST,
|
||||
port: Number(process.env.SMTP_PORT),
|
||||
auth: {
|
||||
user: process.env.SMTP_USER,
|
||||
pass: process.env.SMTP_PASSWORD,
|
||||
},
|
||||
},
|
||||
from: process.env.SMTP_FROM,
|
||||
sendVerificationRequest: async ({ identifier, url, provider }) => {
|
||||
const user = await db.user.findUnique({
|
||||
|
|
@ -51,15 +37,16 @@ export const authOptions: NextAuthOptions = {
|
|||
},
|
||||
})
|
||||
|
||||
const templateId = user?.emailVerified
|
||||
? process.env.POSTMARK_SIGN_IN_TEMPLATE
|
||||
: process.env.POSTMARK_ACTIVATION_TEMPLATE
|
||||
const result = await postmarkClient.sendEmailWithTemplate({
|
||||
TemplateId: user?.emailVerified
|
||||
? POSTMARK_SIGN_IN_TEMPLATE
|
||||
: POSTMARK_ACTIVATION_TEMPLATE,
|
||||
TemplateId: parseInt(templateId),
|
||||
To: identifier,
|
||||
From: provider.from,
|
||||
TemplateModel: {
|
||||
action_url: url,
|
||||
product_name: "Taxonomy",
|
||||
product_name: siteConfig.name,
|
||||
},
|
||||
Headers: [
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue