Skip to content

Commit

Permalink
chore: App-router-migration /auth/new and /auth/saml-idp (#16447)
Browse files Browse the repository at this point in the history
* auth/new: add to app router

* auth/saml-idp: add to app router

* fix
  • Loading branch information
hbjORbj authored and zomars committed Sep 4, 2024
1 parent f3b4776 commit b93b578
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
5 changes: 5 additions & 0 deletions apps/web/app/future/auth/new/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { redirect } from "next/navigation";

export default function Page() {
redirect(process.env.NEXT_PUBLIC_WEBAPP_URL || "https://app.cal.com");
}
1 change: 1 addition & 0 deletions apps/web/app/future/auth/saml-idp/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from "~/auth/saml-idp/saml-idp-view";
23 changes: 23 additions & 0 deletions apps/web/modules/auth/saml-idp/saml-idp-view.tsx
Original file line number Diff line number Diff line change
@@ -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;
}
22 changes: 1 addition & 21 deletions apps/web/pages/auth/saml-idp.tsx
Original file line number Diff line number Diff line change
@@ -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";

0 comments on commit b93b578

Please sign in to comment.