Skip to content

Scheduling infrastructure for absolutely everyone.

chore: [app-router-migration 33] migrate the "verify email" pages (#13198)

Sashab268540d3599
diff --git a/apps/web/app/future/auth/verify-email/page.tsx b/apps/web/app/future/auth/verify-email/page.tsx
new file mode 100644
index 00000000000..a3f88601b03
--- /dev/null
+++ b/apps/web/app/future/auth/verify-email/page.tsx
@@ -0,0 +1,15 @@
+import VerifyEmailPage from "@pages/auth/verify-email";
+import { _generateMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+
+export const generateMetadata = async () => {
+ return await _generateMetadata(
+ (t) => t("check_your_email"),
+ (t) => t("check_your_email")
+ );
+};
+
+export default WithLayout({
+ getLayout: null,
+ Page: VerifyEmailPage,
+})<"P">;
diff --git a/apps/web/app/future/auth/verify/page.tsx b/apps/web/app/future/auth/verify/page.tsx
new file mode 100644
index 00000000000..2fd61682503
--- /dev/null
+++ b/apps/web/app/future/auth/verify/page.tsx
@@ -0,0 +1,11 @@
+import VerifyPage from "@pages/auth/verify";
+import { withAppDirSsr } from "app/WithAppDirSsr";
+import { WithLayout } from "app/layoutHOC";
+
+import { getServerSideProps } from "@server/lib/auth/verify/getServerSideProps";
+
+export default WithLayout({
+ getLayout: null,
+ Page: VerifyPage,
+ getData: withAppDirSsr(getServerSideProps),
+})<"P">;
diff --git a/apps/web/pages/auth/verify-email.tsx b/apps/web/pages/auth/verify-email.tsx
index d0a048ca4b5..2750dfaccd7 100644
--- a/apps/web/pages/auth/verify-email.tsx
+++ b/apps/web/pages/auth/verify-email.tsx
@@ -1,3 +1,5 @@
+"use client";
+
import { MailOpenIcon } from "lucide-react";
import { useSession } from "next-auth/react";
import { useRouter } from "next/navigation";
diff --git a/apps/web/pages/auth/verify.tsx b/apps/web/pages/auth/verify.tsx
index 384efcdac62..ae1100409e6 100644
--- a/apps/web/pages/auth/verify.tsx
+++ b/apps/web/pages/auth/verify.tsx
@@ -1,5 +1,6 @@
+"use client";
+
import { motion } from "framer-motion";
-import type { GetServerSidePropsContext, InferGetServerSidePropsType } from "next";
import { signIn } from "next-auth/react";
import Head from "next/head";
import { usePathname, useRouter } from "next/navigation";
@@ -11,12 +12,15 @@ import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
import { trpc } from "@calcom/trpc/react";
+import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import { Button, showToast } from "@calcom/ui";
import { AlertTriangle, ExternalLink, MailOpen } from "@calcom/ui/components/icon";
import Loader from "@components/Loader";
import PageWrapper from "@components/PageWrapper";
+import { getServerSideProps } from "@server/lib/auth/verify/getServerSideProps";
+
async function sendVerificationLogin(email: string, username: string) {
await signIn("email", {
email: email.toLowerCase(),
@@ -112,7 +116,7 @@ const MailOpenIcon = () => (
</div>
);
-export default function Verify(props: InferGetServerSidePropsType<typeof getServerSideProps>) {
+export default function Verify(props: inferSSRProps<typeof getServerSideProps>) {
const searchParams = useCompatSearchParams();
const pathname = usePathname();
const router = useRouter();
@@ -242,13 +246,5 @@ export default function Verify(props: InferGetServerSidePropsType<typeof getServ
);
}
-export const getServerSideProps = async (context: GetServerSidePropsContext) => {
- const EMAIL_FROM = process.env.EMAIL_FROM;
-
- return {
- props: {
- EMAIL_FROM,
- },
- };
-};
+export { getServerSideProps };
Verify.PageWrapper = PageWrapper;
diff --git a/apps/web/server/lib/auth/verify/getServerSideProps.tsx b/apps/web/server/lib/auth/verify/getServerSideProps.tsx
new file mode 100644
index 00000000000..f665d9da520
--- /dev/null
+++ b/apps/web/server/lib/auth/verify/getServerSideProps.tsx
@@ -0,0 +1,11 @@
+import type { GetServerSidePropsContext } from "next";
+
+export const getServerSideProps = async (_context: GetServerSidePropsContext) => {
+ const EMAIL_FROM = process.env.EMAIL_FROM;
+
+ return {
+ props: {
+ EMAIL_FROM,
+ },
+ };
+};