mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 14:27:34 +00:00
rm invite page
This commit is contained in:
@@ -1,73 +0,0 @@
|
|||||||
import { Alert, AlertType } from "@/components/alert";
|
|
||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
|
||||||
import { InviteForm } from "@/components/invite-form";
|
|
||||||
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
|
||||||
import {
|
|
||||||
getBrandingSettings,
|
|
||||||
getDefaultOrg,
|
|
||||||
getLoginSettings,
|
|
||||||
getPasswordComplexitySettings,
|
|
||||||
} from "@/lib/zitadel";
|
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
|
||||||
|
|
||||||
export default async function Page(props: {
|
|
||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
|
||||||
}) {
|
|
||||||
const searchParams = await props.searchParams;
|
|
||||||
const locale = getLocale();
|
|
||||||
const t = await getTranslations({ locale, namespace: "invite" });
|
|
||||||
|
|
||||||
let { firstname, lastname, email, organization } = searchParams;
|
|
||||||
|
|
||||||
const _headers = await headers();
|
|
||||||
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
|
||||||
|
|
||||||
if (!organization) {
|
|
||||||
const org = await getDefaultOrg({ serviceUrl });
|
|
||||||
if (!org) {
|
|
||||||
throw new Error("No default organization found");
|
|
||||||
}
|
|
||||||
|
|
||||||
organization = org.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
const loginSettings = await getLoginSettings({
|
|
||||||
serviceUrl,
|
|
||||||
organization,
|
|
||||||
});
|
|
||||||
|
|
||||||
const passwordComplexitySettings = await getPasswordComplexitySettings({
|
|
||||||
serviceUrl,
|
|
||||||
organization,
|
|
||||||
});
|
|
||||||
|
|
||||||
const branding = await getBrandingSettings({
|
|
||||||
serviceUrl,
|
|
||||||
organization,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DynamicTheme branding={branding}>
|
|
||||||
<div className="flex flex-col items-center space-y-4">
|
|
||||||
<h1>{t("title")}</h1>
|
|
||||||
<p className="ztdl-p">{t("description")}</p>
|
|
||||||
|
|
||||||
{!loginSettings?.allowRegister ? (
|
|
||||||
<Alert type={AlertType.ALERT}>{t("notAllowed")}</Alert>
|
|
||||||
) : (
|
|
||||||
<Alert type={AlertType.INFO}>{t("info")}</Alert>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{passwordComplexitySettings && loginSettings?.allowRegister && (
|
|
||||||
<InviteForm
|
|
||||||
organization={organization}
|
|
||||||
firstname={firstname}
|
|
||||||
lastname={lastname}
|
|
||||||
email={email}
|
|
||||||
></InviteForm>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</DynamicTheme>
|
|
||||||
);
|
|
||||||
}
|
|
@@ -1,81 +0,0 @@
|
|||||||
import { Alert, AlertType } from "@/components/alert";
|
|
||||||
import { Button, ButtonVariants } from "@/components/button";
|
|
||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
|
||||||
import { getServiceUrlFromHeaders } from "@/lib/service-url";
|
|
||||||
import { getBrandingSettings, getDefaultOrg, getUserByID } from "@/lib/zitadel";
|
|
||||||
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
|
||||||
import { headers } from "next/headers";
|
|
||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
export default async function Page(props: {
|
|
||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
|
||||||
}) {
|
|
||||||
const searchParams = await props.searchParams;
|
|
||||||
const locale = getLocale();
|
|
||||||
const t = await getTranslations({ locale, namespace: "invite" });
|
|
||||||
|
|
||||||
let { userId, organization } = searchParams;
|
|
||||||
|
|
||||||
const _headers = await headers();
|
|
||||||
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
|
||||||
|
|
||||||
if (!organization) {
|
|
||||||
const org = await getDefaultOrg({ serviceUrl });
|
|
||||||
if (!org) {
|
|
||||||
throw new Error("No default organization found");
|
|
||||||
}
|
|
||||||
|
|
||||||
organization = org.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
const branding = await getBrandingSettings({
|
|
||||||
serviceUrl,
|
|
||||||
organization,
|
|
||||||
});
|
|
||||||
|
|
||||||
let user: User | undefined;
|
|
||||||
let human: HumanUser | undefined;
|
|
||||||
if (userId) {
|
|
||||||
const userResponse = await getUserByID({
|
|
||||||
serviceUrl,
|
|
||||||
userId,
|
|
||||||
});
|
|
||||||
if (userResponse) {
|
|
||||||
user = userResponse.user;
|
|
||||||
if (user?.type.case === "human") {
|
|
||||||
human = user.type.value as HumanUser;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<DynamicTheme branding={branding}>
|
|
||||||
<div className="flex flex-col items-center space-y-4">
|
|
||||||
<h1>{t("success.title")}</h1>
|
|
||||||
<p className="ztdl-p">{t("success.description")}</p>
|
|
||||||
{user && (
|
|
||||||
<UserAvatar
|
|
||||||
loginName={user.preferredLoginName}
|
|
||||||
displayName={human?.profile?.displayName}
|
|
||||||
showDropdown={false}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{human?.email?.isVerified ? (
|
|
||||||
<Alert type={AlertType.INFO}>{t("success.verified")}</Alert>
|
|
||||||
) : (
|
|
||||||
<Alert type={AlertType.INFO}>{t("success.notVerifiedYet")}</Alert>
|
|
||||||
)}
|
|
||||||
<div className="mt-8 flex w-full flex-row items-center justify-between">
|
|
||||||
<span></span>
|
|
||||||
<Link href="/invite">
|
|
||||||
<Button type="submit" variant={ButtonVariants.Primary}>
|
|
||||||
{t("success.submit")}
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</DynamicTheme>
|
|
||||||
);
|
|
||||||
}
|
|
Reference in New Issue
Block a user