diff --git a/.env.example b/.env.example index c0e3a2bb309fcb..f08fe97cb50da0 100644 --- a/.env.example +++ b/.env.example @@ -369,7 +369,6 @@ APP_ROUTER_AUTH_LOGIN_ENABLED=0 APP_ROUTER_AUTH_LOGOUT_ENABLED=0 APP_ROUTER_AUTH_NEW_ENABLED=0 APP_ROUTER_AUTH_SAML_ENABLED=0 -APP_ROUTER_AUTH_ERROR_ENABLED=0 APP_ROUTER_AUTH_PLATFORM_ENABLED=0 APP_ROUTER_AUTH_OAUTH2_ENABLED=0 diff --git a/apps/web/abTest/middlewareFactory.ts b/apps/web/abTest/middlewareFactory.ts index 27938472378999..d90c02dc315dc4 100644 --- a/apps/web/abTest/middlewareFactory.ts +++ b/apps/web/abTest/middlewareFactory.ts @@ -15,7 +15,6 @@ const ROUTES: [URLPattern, boolean][] = [ ["/auth/logout", process.env.APP_ROUTER_AUTH_LOGOUT_ENABLED === "1"] as const, ["/auth/new", process.env.APP_ROUTER_AUTH_NEW_ENABLED === "1"] as const, ["/auth/saml-idp", process.env.APP_ROUTER_AUTH_SAML_ENABLED === "1"] as const, - ["/auth/error", process.env.APP_ROUTER_AUTH_ERROR_ENABLED === "1"] as const, ["/auth/platform/:path*", process.env.APP_ROUTER_AUTH_PLATFORM_ENABLED === "1"] as const, ["/auth/oauth2/:path*", process.env.APP_ROUTER_AUTH_OAUTH2_ENABLED === "1"] as const, ["/team", process.env.APP_ROUTER_TEAM_ENABLED === "1"] as const, diff --git a/apps/web/app/auth/error/page.tsx b/apps/web/app/auth/error/page.tsx new file mode 100644 index 00000000000000..e3942ce67beaa8 --- /dev/null +++ b/apps/web/app/auth/error/page.tsx @@ -0,0 +1,47 @@ +import type { PageProps } from "app/_types"; +import { _generateMetadata, getTranslate } from "app/_utils"; +import { WithLayout } from "app/layoutHOC"; +import Link from "next/link"; +import { z } from "zod"; + +import { Button, Icon } from "@calcom/ui"; + +import AuthContainer from "@components/ui/AuthContainer"; + +export const generateMetadata = async () => { + return await _generateMetadata( + (t) => t("error"), + () => "" + ); +}; + +const querySchema = z.object({ + error: z.string().optional(), +}); + +const ServerPage = async ({ searchParams }: PageProps) => { + const t = await getTranslate(); + const { error } = querySchema.parse({ error: searchParams?.error || undefined }); + const errorMsg = error || t("error_during_login"); + return ( + +
+
+ +
+
+ +
+
+
+ + + +
+
+ ); +}; + +export default WithLayout({ ServerPage })<"P">; diff --git a/apps/web/app/future/auth/error/page.tsx b/apps/web/app/future/auth/error/page.tsx deleted file mode 100644 index 12b2b5c97b512f..00000000000000 --- a/apps/web/app/future/auth/error/page.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { withAppDirSsg } from "app/WithAppDirSsg"; -import { _generateMetadata } from "app/_utils"; -import { WithLayout } from "app/layoutHOC"; - -import { getStaticProps } from "@server/lib/auth/error/getStaticProps"; - -import Page from "~/auth/error/error-view"; - -export const generateMetadata = async () => { - return await _generateMetadata( - () => "Error", - () => "" - ); -}; - -const getData = withAppDirSsg(getStaticProps, "future/auth/error"); - -export default WithLayout({ getData, Page, getLayout: null })<"P">; -export const dynamic = "force-static"; diff --git a/apps/web/components/ui/AuthContainer.tsx b/apps/web/components/ui/AuthContainer.tsx index 605875bfc28776..5063234637a13e 100644 --- a/apps/web/components/ui/AuthContainer.tsx +++ b/apps/web/components/ui/AuthContainer.tsx @@ -11,12 +11,13 @@ interface Props { showLogo?: boolean; heading?: string; loading?: boolean; + isAppDir?: boolean; } export default function AuthContainer(props: React.PropsWithChildren) { return (
- + {!props.isAppDir ? : null} {props.showLogo && }
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index 94f36de3214a88..928b2ea86ff721 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -167,7 +167,7 @@ export const config = { "/api/trpc/:path*", "/login", "/auth/login", - "/future/auth/login", + "/auth/error", /** * Paths required by routingForms.handle */ diff --git a/apps/web/modules/auth/error/error-view.tsx b/apps/web/modules/auth/error/error-view.tsx index 2d034a53a0d3d5..967bc20e41fab9 100644 --- a/apps/web/modules/auth/error/error-view.tsx +++ b/apps/web/modules/auth/error/error-view.tsx @@ -9,13 +9,11 @@ import { Button, Icon } from "@calcom/ui"; import AuthContainer from "@components/ui/AuthContainer"; -import type { PageProps } from "@server/lib/auth/error/getStaticProps"; - const querySchema = z.object({ error: z.string().optional(), }); -export default function Error(props: PageProps) { +export default function Error() { const { t } = useLocale(); const searchParams = useSearchParams(); const { error } = querySchema.parse({ error: searchParams?.get("error") || undefined }); diff --git a/apps/web/pages/auth/error.tsx b/apps/web/pages/auth/error.tsx deleted file mode 100644 index 2995d07aafb97b..00000000000000 --- a/apps/web/pages/auth/error.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import PageWrapper from "@components/PageWrapper"; - -import type { PageProps } from "@server/lib/auth/error/getStaticProps"; -import { getStaticProps } from "@server/lib/auth/error/getStaticProps"; - -import Error from "~/auth/error/error-view"; - -const Page = (props: PageProps) => ; -Page.PageWrapper = PageWrapper; -export default Page; -export { getStaticProps }; diff --git a/apps/web/scripts/vercel-app-router-deploy.sh b/apps/web/scripts/vercel-app-router-deploy.sh index ec1256da7fac8a..b6e907e4f8707b 100755 --- a/apps/web/scripts/vercel-app-router-deploy.sh +++ b/apps/web/scripts/vercel-app-router-deploy.sh @@ -16,7 +16,6 @@ checkRoute "$APP_ROUTER_AUTH_LOGIN_ENABLED" app/future/auth/login checkRoute "$APP_ROUTER_AUTH_LOGOUT_ENABLED" app/future/auth/logout checkRoute "$APP_ROUTER_AUTH_NEW_ENABLED" app/future/auth/new checkRoute "$APP_ROUTER_AUTH_SAML_ENABLED" app/future/auth/saml-idp -checkRoute "$APP_ROUTER_AUTH_ERROR_ENABLED" app/future/auth/error checkRoute "$APP_ROUTER_AUTH_PLATFORM_ENABLED" app/future/auth/platform checkRoute "$APP_ROUTER_AUTH_OAUTH2_ENABLED" app/future/auth/oauth2 checkRoute "$APP_ROUTER_TEAM_ENABLED" app/future/team diff --git a/apps/web/server/lib/auth/error/getStaticProps.ts b/apps/web/server/lib/auth/error/getStaticProps.ts deleted file mode 100644 index cc917a12da0ef6..00000000000000 --- a/apps/web/server/lib/auth/error/getStaticProps.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { GetStaticPropsContext, InferGetStaticPropsType } from "next"; - -import { getTranslations } from "@server/lib/getTranslations"; - -export type PageProps = InferGetStaticPropsType; -export const getStaticProps = async (context: GetStaticPropsContext) => { - const i18n = await getTranslations(context); - - return { - props: { - i18n, - }, - }; -}; diff --git a/turbo.json b/turbo.json index 9799e734a74577..6cfdff17d47c60 100644 --- a/turbo.json +++ b/turbo.json @@ -248,7 +248,6 @@ "APP_ROUTER_AUTH_LOGOUT_ENABLED", "APP_ROUTER_AUTH_NEW_ENABLED", "APP_ROUTER_AUTH_SAML_ENABLED", - "APP_ROUTER_AUTH_ERROR_ENABLED", "APP_ROUTER_AUTH_PLATFORM_ENABLED", "APP_ROUTER_AUTH_OAUTH2_ENABLED", "APP_ROUTER_TEAM_ENABLED",