From dce55ec17c0e0c5de93189b79492b855f119049d Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Sat, 31 Aug 2024 15:04:05 -0400 Subject: [PATCH 1/3] auth/new: add to app router --- apps/web/app/future/auth/new/page.tsx | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 apps/web/app/future/auth/new/page.tsx diff --git a/apps/web/app/future/auth/new/page.tsx b/apps/web/app/future/auth/new/page.tsx new file mode 100644 index 00000000000000..87df23a99f8f81 --- /dev/null +++ b/apps/web/app/future/auth/new/page.tsx @@ -0,0 +1,5 @@ +import { redirect } from "next/navigation"; + +export default function Page() { + redirect(process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com"); +} From fe3dc2867d03f35d35634854dac9f8174702c3a0 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Sat, 31 Aug 2024 15:04:21 -0400 Subject: [PATCH 2/3] auth/saml-idp: add to app router --- apps/web/app/future/auth/saml-idp/page.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 apps/web/app/future/auth/saml-idp/page.tsx diff --git a/apps/web/app/future/auth/saml-idp/page.tsx b/apps/web/app/future/auth/saml-idp/page.tsx new file mode 100644 index 00000000000000..7d127d8f4f0072 --- /dev/null +++ b/apps/web/app/future/auth/saml-idp/page.tsx @@ -0,0 +1,13 @@ +import type { PageProps } from "app/_types"; +import { signIn } from "next-auth/react"; + +export default async function Page({ params }: PageProps) { + const code = params.code; + + await signIn("saml-idp", { + callbackUrl: "/", + code, + }); + + return null; +} From 7f7c8519dae7b4d5663740a10297682c6ee3f207 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Sat, 31 Aug 2024 15:12:21 -0400 Subject: [PATCH 3/3] fix --- apps/web/app/future/auth/saml-idp/page.tsx | 14 +---------- .../modules/auth/saml-idp/saml-idp-view.tsx | 23 +++++++++++++++++++ apps/web/pages/auth/saml-idp.tsx | 22 +----------------- 3 files changed, 25 insertions(+), 34 deletions(-) create mode 100644 apps/web/modules/auth/saml-idp/saml-idp-view.tsx diff --git a/apps/web/app/future/auth/saml-idp/page.tsx b/apps/web/app/future/auth/saml-idp/page.tsx index 7d127d8f4f0072..02911d67e0fbeb 100644 --- a/apps/web/app/future/auth/saml-idp/page.tsx +++ b/apps/web/app/future/auth/saml-idp/page.tsx @@ -1,13 +1 @@ -import type { PageProps } from "app/_types"; -import { signIn } from "next-auth/react"; - -export default async function Page({ params }: PageProps) { - const code = params.code; - - await signIn("saml-idp", { - callbackUrl: "/", - code, - }); - - return null; -} +export { default } from "~/auth/saml-idp/saml-idp-view"; diff --git a/apps/web/modules/auth/saml-idp/saml-idp-view.tsx b/apps/web/modules/auth/saml-idp/saml-idp-view.tsx new file mode 100644 index 00000000000000..975e4658778501 --- /dev/null +++ b/apps/web/modules/auth/saml-idp/saml-idp-view.tsx @@ -0,0 +1,23 @@ +"use client"; + +import { signIn } from "next-auth/react"; +import { useEffect } from "react"; + +import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; + +// To handle the IdP initiated login flow callback +export default function SamlIdp() { + const searchParams = useCompatSearchParams(); + + useEffect(() => { + const code = searchParams?.get("code"); + + signIn("saml-idp", { + callbackUrl: "/", + code, + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return null; +} diff --git a/apps/web/pages/auth/saml-idp.tsx b/apps/web/pages/auth/saml-idp.tsx index 661980fa686cc2..02911d67e0fbeb 100644 --- a/apps/web/pages/auth/saml-idp.tsx +++ b/apps/web/pages/auth/saml-idp.tsx @@ -1,21 +1 @@ -import { signIn } from "next-auth/react"; -import { useEffect } from "react"; - -import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; - -// To handle the IdP initiated login flow callback -export default function Page() { - const searchParams = useCompatSearchParams(); - - useEffect(() => { - const code = searchParams?.get("code"); - - signIn("saml-idp", { - callbackUrl: "/", - code, - }); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - return null; -} +export { default } from "~/auth/saml-idp/saml-idp-view";