diff --git a/studio/app/user-not-enabled/page.tsx b/studio/app/user-not-enabled/page.tsx new file mode 100644 index 00000000..1683ad22 --- /dev/null +++ b/studio/app/user-not-enabled/page.tsx @@ -0,0 +1,27 @@ +"use client"; + +import { Grid, Heading, View } from "@adobe/react-spectrum"; +import { withPageAuthRequired } from "@auth0/nextjs-auth0/client"; + +function UserNotEnabledPage() { + return ( + + + User Not Enabled + +

+ Your account has not been enabled. Please contact an administrator at{" "} + vojta@stdio.cz +

+
+
+ ); +} + +export default withPageAuthRequired(UserNotEnabledPage); diff --git a/studio/core/utils/withUserEnabled.tsx b/studio/core/utils/withUserEnabled.tsx index 9ce2b771..0fdbc9f4 100644 --- a/studio/core/utils/withUserEnabled.tsx +++ b/studio/core/utils/withUserEnabled.tsx @@ -3,7 +3,9 @@ import { hasAccess } from "@features/auth/hasAccess"; import { redirect } from "next/navigation"; import { useEffect } from "react"; -export const withUserEnabled = (WrappedComponent: React.FC) => { +export const withUserEnabled = ( + WrappedComponent: React.FC, +) => { // eslint-disable-next-line react/display-name return (props: T) => { const { data: enabled } = useQuery({ @@ -12,7 +14,7 @@ export const withUserEnabled = (WrappedComponent: React.FC) => }); useEffect(() => { - if (enabled === false) redirect("/"); + if (enabled === false) redirect("/user-not-enabled"); }, [enabled]); if (!enabled) return null;