Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: change verification text in email
Marc Seitz9159625aef29
diff --git a/components/emails/email-verification.tsx b/components/emails/email-verification.tsxindex 18a5da8d..69fe3d05 100644--- a/components/emails/email-verification.tsx+++ b/components/emails/email-verification.tsx@@ -16,9 +16,11 @@ import {export default function EmailVerification({verificationURL = "papermark.io",email = "[email protected]",+ isDataroom = false,}: {verificationURL: string;email: string;+ isDataroom: boolean;}) {return (<Html>@@ -34,7 +36,8 @@ export default function EmailVerification({Please verify your email</Text><Text className="text-sm leading-6 text-black">- Please click the verification link below to view the document.+ Please click the verification link below to view the{" "}+ {isDataroom ? "dataroom" : "document"}.</Text><Section className="my-8 text-center"><Buttondiff --git a/lib/emails/send-email-verification.ts b/lib/emails/send-email-verification.tsindex 3f8b7d6e..53a79c84 100644--- a/lib/emails/send-email-verification.ts+++ b/lib/emails/send-email-verification.ts@@ -5,12 +5,17 @@ import { sendEmail } from "@/lib/resend";export const sendVerificationEmail = async (email: string,verificationURL: string,+ isDataroom: boolean = false,) => {- const emailTemplate = EmailVerification({ verificationURL, email });+ const emailTemplate = EmailVerification({+ verificationURL,+ email,+ isDataroom,+ });try {await sendEmail({to: email,- subject: "Verify your email address",+ subject: `Verify your email address to access the ${isDataroom ? "dataroom" : "document"}.`,react: emailTemplate,test: process.env.NODE_ENV === "development",system: true,diff --git a/pages/api/links/[id]/verify-email.ts b/pages/api/links/[id]/verify-email.tsdeleted file mode 100644index 28dcf08a..00000000--- a/pages/api/links/[id]/verify-email.ts+++ /dev/null@@ -1,53 +0,0 @@-import { NextApiRequest, NextApiResponse } from "next";--import z from "zod";--import { sendVerificationEmail } from "@/lib/emails/send-email-verification";-import prisma from "@/lib/prisma";--const bodySchema = z.object({- email: z.string().email(),- password: z.string().nullable(),-});--export default async function handle(- req: NextApiRequest,- res: NextApiResponse,-) {- if (req.method === "POST") {- // POST /api/links/[linkId]/verify-email- const { token, email } = req.body as { token: string; email: string };-- // Check verification code in database- const verification = await prisma.verificationToken.findUnique({- where: {- token: token,- identifier: email,- },- });-- if (!verification) {- res.status(401).json({ message: "Unauthorized access" });- return;- }-- // Check the token's expiration date- if (Date.now() > verification.expires.getTime()) {- res.status(401).json({ message: "Token expired" });- return;- }-- // // remove token from database- // await prisma.verificationToken.delete({- // where: {- // token: token,- // },- // });-- res.status(200).json({ message: "Verification successful" });- } else {- // We only allow GET and POST requests- res.setHeader("Allow", ["POST"]);- return res.status(405).end(`Method ${req.method} Not Allowed`);- }-}diff --git a/pages/api/views-dataroom.ts b/pages/api/views-dataroom.tsindex 6c0375f1..2bda028b 100644--- a/pages/api/views-dataroom.ts+++ b/pages/api/views-dataroom.ts@@ -249,7 +249,7 @@ export default async function handle(verificationUrl = `https://${link.domainSlug}/${link.slug}?token=${hashedToken}&email=${encodeURIComponent(email)}`;}- await sendVerificationEmail(email, verificationUrl);+ waitUntil(sendVerificationEmail(email, verificationUrl, true));res.status(200).json({type: "email-verification",message: "Verification email sent.",