Login:Src:App: get host in server components
This commit is contained in:
parent
4e7c1be759
commit
3447a487ab
@ -24,6 +24,8 @@
|
||||
// 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 { headers } from "next/headers";
|
||||
|
||||
import { FormWrapper } from "@docspace/shared/components/form-wrapper";
|
||||
|
||||
import { getPortalPasswordSettings, getSettings } from "@/utils/actions";
|
||||
@ -37,6 +39,9 @@ type ActivationProps = {
|
||||
async function Page({ searchParams }: ActivationProps) {
|
||||
const type = searchParams.type;
|
||||
|
||||
const headersList = headers();
|
||||
const hostName = headersList.get("x-forwarded-host") ?? "";
|
||||
|
||||
const [settings, passwordSettings] = await Promise.all([
|
||||
getSettings(),
|
||||
getPortalPasswordSettings(),
|
||||
@ -46,7 +51,7 @@ async function Page({ searchParams }: ActivationProps) {
|
||||
<div className="content-top">
|
||||
{settings && typeof settings !== "string" && (
|
||||
<>
|
||||
<GreetingCreateUserContainer type={type} />
|
||||
<GreetingCreateUserContainer type={type} hostName={hostName} />
|
||||
<FormWrapper id="activation-form">
|
||||
<ActivateUserForm
|
||||
passwordHash={settings.passwordHash}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
import { notFound } from "next/navigation";
|
||||
import dynamic from "next/dynamic";
|
||||
import { cookies } from "next/headers";
|
||||
import { cookies, headers } from "next/headers";
|
||||
|
||||
import { FormWrapper } from "@docspace/shared/components/form-wrapper";
|
||||
import { LANGUAGE } from "@docspace/shared/constants";
|
||||
@ -62,6 +62,9 @@ async function Page({ searchParams, params }: LinkInviteProps) {
|
||||
const uid = searchParams.uid;
|
||||
const confirmKey = getStringFromSearchParams(searchParams);
|
||||
|
||||
const headersList = headers();
|
||||
const hostName = headersList.get("x-forwarded-host") ?? "";
|
||||
|
||||
const [settings, user, thirdParty, capabilities, passwordSettings] =
|
||||
await Promise.all([
|
||||
getSettings(),
|
||||
@ -87,6 +90,7 @@ async function Page({ searchParams, params }: LinkInviteProps) {
|
||||
firstName={user?.firstName}
|
||||
lastName={user?.lastName}
|
||||
culture={culture}
|
||||
hostName={hostName}
|
||||
/>
|
||||
<FormWrapper id="invite-form">
|
||||
<CreateUserForm
|
||||
|
@ -24,12 +24,12 @@
|
||||
// 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 { headers } from "next/headers";
|
||||
|
||||
import ConfirmRoute from "@/components/ConfirmRoute";
|
||||
import { StyledBody, StyledPage } from "@/components/StyledConfirm.styled";
|
||||
import { TConfirmLinkParams } from "@/types";
|
||||
|
||||
import { checkConfirmLink, getSettings } from "@/utils/actions";
|
||||
import { headers } from "next/headers";
|
||||
|
||||
export default async function Layout({
|
||||
children,
|
||||
|
Loading…
Reference in New Issue
Block a user