diff --git a/packages/login/src/app/(root)/consent/page.tsx b/packages/login/src/app/(root)/consent/page.tsx index a63ebdba08..dde3efb055 100644 --- a/packages/login/src/app/(root)/consent/page.tsx +++ b/packages/login/src/app/(root)/consent/page.tsx @@ -23,11 +23,20 @@ // All the Product's GUI elements, including illustrations and icon sets, as well as technical writing // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode +import { cookies } from "next/headers"; import { IClientProps } from "@docspace/shared/utils/oauth/types"; +import { ColorTheme, ThemeId } from "@docspace/shared/components/color-theme"; +import { LANGUAGE } from "@docspace/shared/constants"; import Consent from "@/components/Consent"; -import { getOAuthClient, getScopeList, getUser } from "@/utils/actions"; +import { + getOAuthClient, + getScopeList, + getSettings, + getUser, +} from "@/utils/actions"; +import { GreetingLoginContainer } from "@/components/GreetingContainer"; async function Page({ searchParams, @@ -35,17 +44,45 @@ async function Page({ searchParams: { [key: string]: string }; }) { const clientId = searchParams.clientId ?? searchParams.client_id; - const [client, scopes, user] = await Promise.all([ + const [client, scopes, user, settings] = await Promise.all([ getOAuthClient(clientId), getScopeList(), getUser(), + getSettings(), ]); if (!client || (client && !("clientId" in client)) || !scopes || !user) return ""; + const isRegisterContainerVisible = + typeof settings === "string" ? undefined : settings?.enabledJoin; + + const settingsCulture = + typeof settings === "string" ? undefined : settings?.culture; + + const culture = cookies().get(LANGUAGE)?.value ?? settingsCulture; + return ( - + <> + {settings && typeof settings !== "string" && ( + + <> + + + + + )} + ); } diff --git a/packages/login/src/app/(root)/page.tsx b/packages/login/src/app/(root)/page.tsx index 4e227cee0f..ffa6c7c3d6 100644 --- a/packages/login/src/app/(root)/page.tsx +++ b/packages/login/src/app/(root)/page.tsx @@ -106,36 +106,25 @@ async function Page({ ldapDomain={capabilities?.ldapDomain} ldapEnabled={capabilities?.ldapEnabled || false} /> - + {!clientId && ( + + )} {settings.enableAdmMess && } {settings.enabledJoin && ( - <> - - {!clientId && } - {settings.enableAdmMess && } - {settings.enabledJoin && ( - - )} - + )} diff --git a/packages/login/src/app/(root)/tenant-list/page.tsx b/packages/login/src/app/(root)/tenant-list/page.tsx index a187410f32..7c91e040c4 100644 --- a/packages/login/src/app/(root)/tenant-list/page.tsx +++ b/packages/login/src/app/(root)/tenant-list/page.tsx @@ -1,5 +1,10 @@ +import { cookies } from "next/headers"; + +import { GreetingLoginContainer } from "@/components/GreetingContainer"; import TenantList from "@/components/TenantList"; import { getSettings } from "@/utils/actions"; +import { ColorTheme, ThemeId } from "@docspace/shared/components/color-theme"; +import { LANGUAGE } from "@docspace/shared/constants"; export default async function Page({ searchParams, @@ -11,13 +16,33 @@ export default async function Page({ const { portals } = JSON.parse(searchParams.portals); const clientId = searchParams.clientId; - if (typeof settings !== "object") return; + const isRegisterContainerVisible = + typeof settings === "string" ? undefined : settings?.enabledJoin; + const settingsCulture = + typeof settings === "string" ? undefined : settings?.culture; + + const culture = cookies().get(LANGUAGE)?.value ?? settingsCulture; return ( - + <> + {settings && typeof settings !== "string" && ( + + <> + + + + + )} + ); } diff --git a/packages/login/src/components/LoginForm/index.tsx b/packages/login/src/components/LoginForm/index.tsx index eef99f3131..de0d706369 100644 --- a/packages/login/src/components/LoginForm/index.tsx +++ b/packages/login/src/components/LoginForm/index.tsx @@ -283,11 +283,11 @@ const LoginForm = ({ PasswordHash: hash, }); - if (portals.length === 1) { - window.open(`${portals[0].portalLink}`, "_self"); + // if (portals.length === 1) { + // window.open(`${portals[0].portalLink}`, "_self"); - return; - } + // return; + // } const searchParams = new URLSearchParams(); @@ -319,7 +319,7 @@ const LoginForm = ({ } return res; }) - .then((res: string | object) => { + .then((res?: string | object) => { const isConfirm = typeof res === "string" && res.includes("confirm"); const redirectPath = referenceUrl || sessionStorage.getItem("referenceUrl"); @@ -439,7 +439,7 @@ const LoginForm = ({ return (
- {!emailFromInvitation && ( + {!emailFromInvitation && !client && ( {t("Common:LoginButton")}