* remove references to /pages for sso, setup, signin pages in /auth * remove references to pages for insights * remove references to pages for d * remove references to pages for signup * add page for /future index page * fix routing-forms * fix * add missing defaults * use getServerSessionForAppDir instead * fix apps/[slug]/[...pages] * fix metadata in apps/slug/pages * refactor * refactor * remove duplicate code for PageProps * remove references to pages for /reschedule * fix * fix routing forms * type fix * fix routing forms again * revert changes for app/slug/pages * revert * revert changes in yarn lock --------- Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
"use client";
|
|
|
|
import { signIn } from "next-auth/react";
|
|
import { useRouter } from "next/navigation";
|
|
import { useEffect } from "react";
|
|
|
|
import { HOSTED_CAL_FEATURES } from "@calcom/lib/constants";
|
|
|
|
import type { inferSSRProps } from "@lib/types/inferSSRProps";
|
|
|
|
import type { getServerSideProps } from "@server/lib/auth/sso/direct/getServerSideProps";
|
|
|
|
// This page is used to initiate the SAML authentication flow by redirecting to the SAML provider.
|
|
// Accessible only on self-hosted Cal.com instances.
|
|
|
|
export type SSODirectPageProps = inferSSRProps<typeof getServerSideProps>;
|
|
export default function Page({ samlTenantID, samlProductID }: SSODirectPageProps) {
|
|
const router = useRouter();
|
|
|
|
useEffect(() => {
|
|
if (HOSTED_CAL_FEATURES) {
|
|
router.push("/auth/login");
|
|
}
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
useEffect(() => {
|
|
// Initiate SAML authentication flow
|
|
signIn(
|
|
"saml",
|
|
{
|
|
callbackUrl: "/",
|
|
},
|
|
{ tenant: samlTenantID, product: samlProductID }
|
|
);
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, []);
|
|
|
|
return null;
|
|
}
|