Skip to content

Scheduling infrastructure for absolutely everyone.

migrate /auth/login page (#18903)

Benny Joodf4359e3e514
diff --git a/apps/web/app/(use-page-wrapper)/auth/login/page.tsx b/apps/web/app/(use-page-wrapper)/auth/login/page.tsx
new file mode 100644
index 00000000000..9ccefad02c9
--- /dev/null
+++ b/apps/web/app/(use-page-wrapper)/auth/login/page.tsx
@@ -0,0 +1,27 @@
+import { withAppDirSsr } from "app/WithAppDirSsr";
+import type { PageProps as ServerPageProps } from "app/_types";
+import { _generateMetadata } from "app/_utils";
+import { cookies, headers } from "next/headers";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+
+import { getServerSideProps } from "@server/lib/auth/login/getServerSideProps";
+
+import type { PageProps as ClientPageProps } from "~/auth/login-view";
+import Login from "~/auth/login-view";
+
+export const generateMetadata = async () => {
+ return await _generateMetadata(
+ (t) => t("login"),
+ (t) => t("login")
+ );
+};
+
+const getData = withAppDirSsr<ClientPageProps>(getServerSideProps);
+
+const ServerPage = async ({ params, searchParams }: ServerPageProps) => {
+ const props = await getData(buildLegacyCtx(headers(), cookies(), params, searchParams));
+ return <Login {...props} />;
+};
+
+export default ServerPage;
diff --git a/apps/web/app/future/auth/login/page.tsx b/apps/web/app/future/auth/login/page.tsx
deleted file mode 100644
index 1117171c939..00000000000
--- a/apps/web/app/future/auth/login/page.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import { withAppDirSsr } from "app/WithAppDirSsr";
-import { _generateMetadata } from "app/_utils";
-import { WithLayout } from "app/layoutHOC";
-
-import { getServerSideProps } from "@server/lib/auth/login/getServerSideProps";
-
-import type { PageProps } from "~/auth/login-view";
-import Login from "~/auth/login-view";
-
-export const generateMetadata = async () => {
- return await _generateMetadata(
- (t) => t("login"),
- (t) => t("login")
- );
-};
-
-export default WithLayout({
- getLayout: null,
- Page: Login,
- getData: withAppDirSsr<PageProps>(getServerSideProps),
-})<"P">;
diff --git a/apps/web/modules/auth/error/error-view.tsx b/apps/web/modules/auth/error/error-view.tsx
deleted file mode 100644
index 967bc20e41f..00000000000
--- a/apps/web/modules/auth/error/error-view.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-"use client";
-
-import Link from "next/link";
-import { useSearchParams } from "next/navigation";
-import z from "zod";
-
-import { useLocale } from "@calcom/lib/hooks/useLocale";
-import { Button, Icon } from "@calcom/ui";
-
-import AuthContainer from "@components/ui/AuthContainer";
-
-const querySchema = z.object({
- error: z.string().optional(),
-});
-
-export default function Error() {
- const { t } = useLocale();
- const searchParams = useSearchParams();
- const { error } = querySchema.parse({ error: searchParams?.get("error") || undefined });
- const errorMsg = error || t("error_during_login");
- return (
- <AuthContainer title="" description="">
- <div>
- <div className="bg-error mx-auto flex h-12 w-12 items-center justify-center rounded-full">
- <Icon name="x" className="h-6 w-6 text-red-600" />
- </div>
- <div className="mt-3 text-center sm:mt-5">
- <h3 className="text-emphasis text-lg font-medium leading-6" id="modal-title">
- {errorMsg}
- </h3>
- </div>
- </div>
- <div className="mt-5 sm:mt-6">
- <Link href="/auth/login" passHref legacyBehavior>
- <Button className="flex w-full justify-center">{t("go_back_login")}</Button>
- </Link>
- </div>
- </AuthContainer>
- );
-}
diff --git a/apps/web/modules/auth/login-view.tsx b/apps/web/modules/auth/login-view.tsx
index 0f8ba9628e5..9a4b39e6095 100644
--- a/apps/web/modules/auth/login-view.tsx
+++ b/apps/web/modules/auth/login-view.tsx
@@ -182,6 +182,7 @@ PageProps & WithNonceProps<{}>) {
return (
<div className="dark:bg-brand dark:text-brand-contrast text-emphasis min-h-screen [--cal-brand-emphasis:#101010] [--cal-brand-subtle:#9CA3AF] [--cal-brand-text:white] [--cal-brand:#111827] dark:[--cal-brand-emphasis:#e1e1e1] dark:[--cal-brand-text:black] dark:[--cal-brand:white]">
<AuthContainer
+ isAppDir
title={t("login")}
description={t("login")}
showLogo
diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx
deleted file mode 100644
index c86b8c20334..00000000000
--- a/apps/web/pages/auth/login.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps } from "~/auth/login-view";
-import Login from "~/auth/login-view";
-
-const Page = (props: PageProps) => <Login {...props} />;
-Page.PageWrapper = PageWrapper;
-
-export default Page;
-export { getServerSideProps } from "@server/lib/auth/login/getServerSideProps";