* Verify - inital email commit * Add token type - api redirect - migration * Redirect and valid api callback route * Update email design * Change signup URL to redirect to verify-email * Add feature flag - add a11y text to email - add top banner * Shell shouldnt redirect to onboarding if the user needs to verify account * Move flag check to server * Cleanup * Rate limit * Fix redirects * Remove api signup mess * Double negation for forced bool * Fix props * Update packages/emails/templates/account-verify-email.ts * Enable migration by default * Fix typos * Fix google verify issue * Update packages/features/auth/lib/verifyEmail.ts Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> * NITS: @harioms addressed * Remove schema changes * Fix NITs+ improvments * Update apps/web/pages/api/auth/verify-email.ts Co-authored-by: Omar López <zomars@me.com> * Update packages/features/ee/common/components/LicenseRequired.tsx Co-authored-by: Omar López <zomars@me.com> * Update apps/web/pages/api/auth/verify-email.ts Co-authored-by: Omar López <zomars@me.com> * Always preloads feature flags * Update verifyEmail.ts * Update schema.prisma * Type fix --------- Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Omar López <zomars@me.com>
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import type { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
import { renderEmail } from "@calcom/emails";
|
|
import { getTranslation } from "@calcom/lib/server/i18n";
|
|
|
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|
if (process.env.NODE_ENV !== "development") return res.write("Only for development purposes"), res.end();
|
|
const t = await getTranslation("en", "common");
|
|
const language = { translate: t, locale: "en" };
|
|
|
|
const evt = {
|
|
type: "30min",
|
|
title: "30min between Pro Example and pro@example.com",
|
|
description: null,
|
|
additionalNotes: "asdasdas",
|
|
startTime: "2022-06-03T09:00:00-06:00",
|
|
endTime: "2022-06-03T09:30:00-06:00",
|
|
organizer: {
|
|
name: "Pro Example",
|
|
email: "pro@example.com",
|
|
timeZone: "Europe/London",
|
|
language,
|
|
},
|
|
attendees: [
|
|
{
|
|
email: "pro@example.com",
|
|
name: "pro@example.com",
|
|
timeZone: "America/Chihuahua",
|
|
language,
|
|
},
|
|
],
|
|
location: "Zoom video",
|
|
destinationCalendar: null,
|
|
hideCalendarNotes: false,
|
|
uid: "xxyPr4cg2xx4XoS2KeMEQy",
|
|
metadata: {},
|
|
recurringEvent: null,
|
|
appsStatus: [
|
|
{
|
|
appName: "Outlook Calendar",
|
|
type: "office365_calendar",
|
|
success: 1,
|
|
failures: 0,
|
|
errors: [],
|
|
warnings: [],
|
|
},
|
|
{
|
|
appName: "Google Meet",
|
|
type: "conferencing",
|
|
success: 0,
|
|
failures: 1,
|
|
errors: [],
|
|
warnings: ["In order to use Google Meet you must set your destination calendar to a Google Calendar"],
|
|
},
|
|
],
|
|
};
|
|
|
|
req.statusCode = 200;
|
|
|
|
res.setHeader("Content-Type", "text/html");
|
|
res.setHeader("Cache-Control", "no-cache, no-store, private, must-revalidate");
|
|
res.write(
|
|
renderEmail("VerifyAccountEmail", {
|
|
language: t,
|
|
user: {
|
|
name: "Pro Example",
|
|
email: "pro@example.com",
|
|
},
|
|
verificationEmailLink:
|
|
"http://localhost:3000/api/auth/verify-email?token=b91af0eee5a9a24a8d83a3d3d6a58c1606496e94ced589441649273c66100f5b",
|
|
})
|
|
);
|
|
res.end();
|
|
};
|
|
|
|
export default handler;
|