2023-04-26 15:14:28 +02:00
|
|
|
import {
|
2024-04-01 13:57:39 +02:00
|
|
|
getBrandingSettings,
|
2023-05-15 09:23:59 +02:00
|
|
|
getLegalAndSupportSettings,
|
|
|
|
|
getPasswordComplexitySettings,
|
2024-05-13 16:17:12 -04:00
|
|
|
} from "@/lib/zitadel";
|
|
|
|
|
import DynamicTheme from "@/ui/DynamicTheme";
|
|
|
|
|
import RegisterFormWithoutPassword from "@/ui/RegisterFormWithoutPassword";
|
|
|
|
|
import SetPasswordForm from "@/ui/SetPasswordForm";
|
2023-06-16 13:57:29 +02:00
|
|
|
|
|
|
|
|
export default async function Page({
|
|
|
|
|
searchParams,
|
|
|
|
|
}: {
|
|
|
|
|
searchParams: Record<string | number | symbol, string | undefined>;
|
|
|
|
|
}) {
|
2024-03-25 15:18:51 +01:00
|
|
|
const { firstname, lastname, email, organization, authRequestId } =
|
|
|
|
|
searchParams;
|
2023-06-16 13:57:29 +02:00
|
|
|
|
|
|
|
|
const setPassword = !!(firstname && lastname && email);
|
|
|
|
|
|
2024-04-07 03:56:46 -04:00
|
|
|
const legal = await getLegalAndSupportSettings(organization);
|
|
|
|
|
const passwordComplexitySettings =
|
|
|
|
|
await getPasswordComplexitySettings(organization);
|
2023-04-03 13:39:51 +02:00
|
|
|
|
2024-04-07 03:56:46 -04:00
|
|
|
const branding = await getBrandingSettings(organization);
|
2024-04-01 13:57:39 +02:00
|
|
|
|
2023-06-16 13:57:29 +02:00
|
|
|
return setPassword ? (
|
2024-04-01 13:57:39 +02:00
|
|
|
<DynamicTheme branding={branding}>
|
|
|
|
|
<div className="flex flex-col items-center space-y-4">
|
|
|
|
|
<h1>Set Password</h1>
|
|
|
|
|
<p className="ztdl-p">Set the password for your account</p>
|
2023-06-16 13:57:29 +02:00
|
|
|
|
2024-04-01 13:57:39 +02:00
|
|
|
{legal && passwordComplexitySettings && (
|
|
|
|
|
<SetPasswordForm
|
|
|
|
|
passwordComplexitySettings={passwordComplexitySettings}
|
|
|
|
|
email={email}
|
|
|
|
|
firstname={firstname}
|
|
|
|
|
lastname={lastname}
|
|
|
|
|
organization={organization}
|
|
|
|
|
authRequestId={authRequestId}
|
|
|
|
|
></SetPasswordForm>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</DynamicTheme>
|
2023-06-16 13:57:29 +02:00
|
|
|
) : (
|
2024-04-01 13:57:39 +02:00
|
|
|
<DynamicTheme branding={branding}>
|
|
|
|
|
<div className="flex flex-col items-center space-y-4">
|
|
|
|
|
<h1>Register</h1>
|
|
|
|
|
<p className="ztdl-p">Create your ZITADEL account.</p>
|
2023-04-03 13:39:51 +02:00
|
|
|
|
2024-04-01 13:57:39 +02:00
|
|
|
{legal && passwordComplexitySettings && (
|
|
|
|
|
<RegisterFormWithoutPassword
|
|
|
|
|
legal={legal}
|
|
|
|
|
organization={organization}
|
|
|
|
|
authRequestId={authRequestId}
|
|
|
|
|
></RegisterFormWithoutPassword>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</DynamicTheme>
|
2023-04-03 13:39:51 +02:00
|
|
|
);
|
|
|
|
|
}
|