2023-04-26 15:14:28 +02:00
|
|
|
import {
|
2023-05-15 09:23:59 +02:00
|
|
|
getLegalAndSupportSettings,
|
|
|
|
|
getPasswordComplexitySettings,
|
2023-04-26 15:14:28 +02:00
|
|
|
server,
|
|
|
|
|
} from "#/lib/zitadel";
|
2023-06-16 13:57:29 +02:00
|
|
|
import RegisterFormWithoutPassword from "#/ui/RegisterFormWithoutPassword";
|
|
|
|
|
import SetPasswordForm from "#/ui/SetPasswordForm";
|
|
|
|
|
|
|
|
|
|
export default async function Page({
|
|
|
|
|
searchParams,
|
|
|
|
|
}: {
|
|
|
|
|
searchParams: Record<string | number | symbol, string | undefined>;
|
|
|
|
|
}) {
|
|
|
|
|
const { firstname, lastname, email } = searchParams;
|
|
|
|
|
|
|
|
|
|
const setPassword = !!(firstname && lastname && email);
|
|
|
|
|
|
2023-05-15 09:23:59 +02:00
|
|
|
const legal = await getLegalAndSupportSettings(server);
|
2023-07-04 14:52:33 +02:00
|
|
|
console.log("legal", legal);
|
2023-05-15 09:23:59 +02:00
|
|
|
const passwordComplexitySettings = await getPasswordComplexitySettings(
|
|
|
|
|
server
|
|
|
|
|
);
|
2023-07-04 14:52:33 +02:00
|
|
|
console.log("complexity", passwordComplexitySettings);
|
2023-04-03 13:39:51 +02:00
|
|
|
|
2023-06-16 13:57:29 +02:00
|
|
|
return setPassword ? (
|
|
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
{legal && passwordComplexitySettings && (
|
|
|
|
|
<SetPasswordForm
|
|
|
|
|
passwordComplexitySettings={passwordComplexitySettings}
|
|
|
|
|
email={email}
|
|
|
|
|
firstname={firstname}
|
|
|
|
|
lastname={lastname}
|
|
|
|
|
></SetPasswordForm>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
2023-04-03 13:39:51 +02:00
|
|
|
<div className="flex flex-col items-center space-y-4">
|
2023-04-26 13:17:54 +02:00
|
|
|
<h1>Register</h1>
|
|
|
|
|
<p className="ztdl-p">Create your ZITADEL account.</p>
|
2023-04-03 13:39:51 +02:00
|
|
|
|
2023-05-15 09:23:59 +02:00
|
|
|
{legal && passwordComplexitySettings && (
|
2023-06-16 13:57:29 +02:00
|
|
|
<RegisterFormWithoutPassword
|
2023-05-17 17:04:56 +02:00
|
|
|
legal={legal}
|
2023-06-16 13:57:29 +02:00
|
|
|
></RegisterFormWithoutPassword>
|
2023-04-26 15:14:28 +02:00
|
|
|
)}
|
2023-04-03 13:39:51 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|