The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add email change notification template and send confirmation email
Kiran Kc4e2accd06e3
diff --git a/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsx b/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsxindex ce9f59a703..fc57fcc94e 100644--- a/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/auth/confirm-email-change/[token]/page.tsx@@ -1,8 +1,10 @@import { getSession, hashToken } from "@/lib/auth";import { redis } from "@/lib/upstash";import EmptyState from "@/ui/shared/empty-state";+import { sendEmail } from "@dub/email";import { subscribe } from "@dub/email/resend/subscribe";import { unsubscribe } from "@dub/email/resend/unsubscribe";+import { EmailUpdated } from "@dub/email/templates/email-updated";import { prisma } from "@dub/prisma";import { InputPassword, LoadingSpinner } from "@dub/ui";import { VerificationToken } from "@prisma/client";@@ -117,6 +119,14 @@ const VerifyEmailChange = async ({subscribe({ email: data.newEmail }),]: []),++ sendEmail({+ subject: "Your email address has been changed",+ email: data.email,+ react: EmailUpdated({+ newEmail: data.newEmail,+ }),+ }),]),);diff --git a/packages/email/src/templates/email-updated.tsx b/packages/email/src/templates/email-updated.tsxnew file mode 100644index 0000000000..45c4d19a38--- /dev/null+++ b/packages/email/src/templates/email-updated.tsx@@ -0,0 +1,63 @@+import { DUB_WORDMARK } from "@dub/utils";+import {+ Body,+ Container,+ Head,+ Heading,+ Html,+ Img,+ Link,+ Preview,+ Section,+ Tailwind,+ Text,+} from "@react-email/components";+import { Footer } from "../components/footer";++export function EmailUpdated({+ newEmail = "[email protected]",+}: {+ newEmail: string;+}) {+ return (+ <Html>+ <Head />+ <Preview>Your email address has been updated</Preview>+ <Tailwind>+ <Body className="mx-auto my-auto bg-white font-sans">+ <Container className="mx-auto my-10 max-w-[500px] rounded border border-solid border-gray-200 px-10 py-5">+ <Section className="mt-8">+ <Img+ src={DUB_WORDMARK}+ height="40"+ alt="Dub"+ className="mx-auto my-0"+ />+ </Section>+ <Heading className="mx-0 my-7 p-0 text-center text-xl font-semibold text-black">+ Your email address has been changed+ </Heading>+ <Text className="mx-auto text-sm leading-6">+ The e-mail address for your Dub account has been changed to{" "}+ <strong>{newEmail}</strong>.+ </Text>+ <Text className="text-sm leading-6 text-black">+ If you did not make this change, please contact our support team+ or{" "}+ <Link href="https://app.dub.co/account/settings">+ update your email address+ </Link>+ .+ </Text>+ <Text className="text-sm leading-6 text-black">+ This message is being sent to your old e-mail address only.+ </Text>+ <Footer email={newEmail} />+ </Container>+ </Body>+ </Tailwind>+ </Html>+ );+}++export default EmailUpdated;