From 9c1b158291c2bb15a73d818a9597bc854afcbfc0 Mon Sep 17 00:00:00 2001 From: Lorenzo Palaia Date: Fri, 4 Apr 2025 13:22:59 +0200 Subject: [PATCH] feat: hide create account button on ENABLE_SIGNUP=0 (#6841) --- web/app/accounts/forgot-password/page.tsx | 49 ++++++++++++++--------- web/app/page.tsx | 40 +++++++++++------- 2 files changed, 54 insertions(+), 35 deletions(-) diff --git a/web/app/accounts/forgot-password/page.tsx b/web/app/accounts/forgot-password/page.tsx index 22a241db6..1082a1ab3 100644 --- a/web/app/accounts/forgot-password/page.tsx +++ b/web/app/accounts/forgot-password/page.tsx @@ -6,6 +6,7 @@ import Link from "next/link"; import { useSearchParams } from "next/navigation"; import { useTheme } from "next-themes"; import { Controller, useForm } from "react-hook-form"; +import useSWR from "swr"; // icons import { CircleCheck } from "lucide-react"; // plane imports @@ -17,7 +18,7 @@ import { EPageTypes } from "@/helpers/authentication.helper"; import { cn } from "@/helpers/common.helper"; import { checkEmailValidity } from "@/helpers/string.helper"; // hooks -import { useEventTracker } from "@/hooks/store"; +import { useEventTracker, useInstance } from "@/hooks/store"; import useTimer from "@/hooks/use-timer"; // wrappers import { AuthenticationWrapper } from "@/lib/wrappers"; @@ -48,6 +49,7 @@ const ForgotPasswordPage = observer(() => { const { t } = useTranslation(); // store hooks const { captureEvent } = useEventTracker(); + const { fetchInstanceConfigurations, formattedConfig } = useInstance(); // hooks const { resolvedTheme } = useTheme(); // timer @@ -93,6 +95,11 @@ const ForgotPasswordPage = observer(() => { }); }; + useSWR("INSTANCE_CONFIGURATIONS", () => fetchInstanceConfigurations()); + + // derived values + const enableSignUpConfig = formattedConfig?.ENABLE_SIGNUP ?? ""; + const logo = resolvedTheme === "light" ? BlackHorizontalLogo : WhiteHorizontalLogo; return ( @@ -101,39 +108,41 @@ const ForgotPasswordPage = observer(() => {
Plane background pattern
-
-
-
+
+
+
Plane logo
-
- {t("auth.common.new_to_plane")} - captureEvent(NAVIGATE_TO_SIGNUP, {})} - className="font-semibold text-custom-primary-100 hover:underline" - > - {t("auth.common.create_account")} - -
+ {enableSignUpConfig && ( +
+ {t("auth.common.new_to_plane")} + captureEvent(NAVIGATE_TO_SIGNUP, {})} + className="font-semibold text-custom-primary-100 hover:underline" + > + {t("auth.common.create_account")} + +
+ )}
-
+
-
-

+
+

{t("auth.forgot_password.title")}

{t("auth.forgot_password.description")}

-