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