diff --git a/apps/console/src/pages/iam/auth/PersonalAccountNotAllowedPage.tsx b/apps/console/src/pages/iam/auth/AuthErrorPage.tsx similarity index 59% rename from apps/console/src/pages/iam/auth/PersonalAccountNotAllowedPage.tsx rename to apps/console/src/pages/iam/auth/AuthErrorPage.tsx index 2c399c34c..7636d6751 100644 --- a/apps/console/src/pages/iam/auth/PersonalAccountNotAllowedPage.tsx +++ b/apps/console/src/pages/iam/auth/AuthErrorPage.tsx @@ -21,21 +21,46 @@ import { usePageTitle } from "@probo/hooks"; import { useTranslate } from "@probo/i18n"; import { Button } from "@probo/ui"; +import { useSearchParams } from "react-router"; -export default function PersonalAccountNotAllowedPage() { +type AuthErrorContent = { + title: string; + description: string; +}; + +function useAuthErrorContent(code: string | null): AuthErrorContent { const { __ } = useTranslate(); - usePageTitle(__("Enterprise account required")); + switch (code) { + case "personal_account_not_allowed": + return { + title: __("Enterprise account required"), + description: __( + "Personal Google and Microsoft accounts cannot be used to sign in. Please use your work or school account instead.", + ), + }; + default: + return { + title: __("Authentication failed"), + description: __( + "We could not complete your sign-in. Please try again.", + ), + }; + } +} + +export default function AuthErrorPage() { + const { __ } = useTranslate(); + const [searchParams] = useSearchParams(); + const content = useAuthErrorContent(searchParams.get("error")); + + usePageTitle(content.title); return (
-

{__("Enterprise account required")}

-

- {__( - "Personal Google and Microsoft accounts cannot be used to sign in. Please use your work or school account instead.", - )} -

+

{content.title}

+

{content.description}