From 4d38c6d0c73a677878f661f048b8dcf3a09047b9 Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:25:08 +0530 Subject: [PATCH] fix: Form link in Reroute Dialog gives 404 for members that aren't admin/owner of team (#17537) * fix: Form link in Reroute Dialog gives 404 for members that aren't admin/owner of team * NIT --- apps/web/components/PageWrapper.tsx | 2 ++ apps/web/components/PageWrapperAppDir.tsx | 2 ++ apps/web/pages/403.tsx | 30 +++++++++++++++++++ apps/web/public/static/locales/en/common.json | 3 ++ .../getServerSidePropsSingleForm.ts | 5 +++- 5 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 apps/web/pages/403.tsx diff --git a/apps/web/components/PageWrapper.tsx b/apps/web/components/PageWrapper.tsx index 05c5ddeedd..9270504f0e 100644 --- a/apps/web/components/PageWrapper.tsx +++ b/apps/web/components/PageWrapper.tsx @@ -40,6 +40,8 @@ function PageWrapper(props: AppProps) { pageStatus = "404"; } else if (router.pathname === "/500") { pageStatus = "500"; + } else if (router.pathname === "/403") { + pageStatus = "403"; } // On client side don't let nonce creep into DOM diff --git a/apps/web/components/PageWrapperAppDir.tsx b/apps/web/components/PageWrapperAppDir.tsx index e729918bd4..7ffc679986 100644 --- a/apps/web/components/PageWrapperAppDir.tsx +++ b/apps/web/components/PageWrapperAppDir.tsx @@ -31,6 +31,8 @@ function PageWrapper(props: PageWrapperProps) { pageStatus = "404"; } else if (pathname === "/500") { pageStatus = "500"; + } else if (pathname === "/403") { + pageStatus = "403"; } // On client side don't let nonce creep into DOM diff --git a/apps/web/pages/403.tsx b/apps/web/pages/403.tsx new file mode 100644 index 0000000000..32e8ac8c6e --- /dev/null +++ b/apps/web/pages/403.tsx @@ -0,0 +1,30 @@ +import Head from "next/head"; + +import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants"; +import { useLocale } from "@calcom/lib/hooks/useLocale"; +import { Button } from "@calcom/ui"; + +import PageWrapper from "@components/PageWrapper"; + +export default function AccessDenied() { + const { t } = useLocale(); + + return ( +
+ {t("you_need_admin_or_owner_privileges_to_access")} +
+ +