Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+342
-149
@@ -1,20 +1,20 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Form, Link, useNavigate, useNavigation, useSearchParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FeatherArrowLeft, FeatherBuilding, FeatherMail, FeatherMailCheck, FeatherPencil, FeatherRotateCw } from "@subframe/core";
|
||||
import { FeatherArrowLeft, FeatherBuilding, FeatherMailCheck, FeatherPencil, FeatherRotateCw } from "@subframe/core";
|
||||
import { useRootData } from "~/utils/data/useRootData";
|
||||
import { AuthShell } from "~/components/auth/AuthShell";
|
||||
import { Alert } from "~/ui/components/Alert";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { Checkbox } from "~/ui/components/Checkbox";
|
||||
import { IconWithBackground } from "~/ui/components/IconWithBackground";
|
||||
import { LinkButton } from "~/ui/components/LinkButton";
|
||||
import { Logo } from "~/ui/components/Logo";
|
||||
import { Progress } from "~/ui/components/Progress";
|
||||
import { StepperHorizontal } from "~/ui/components/StepperHorizontal";
|
||||
import { TextInput } from "~/ui/components/TextInput";
|
||||
import Captcha from "~/components/captcha/Captcha";
|
||||
import { getPasswordChecks, type PasswordPolicy } from "~/modules/users/components/RegisterForm";
|
||||
import { RegistrationPlanStep } from "~/modules/users/components/RegistrationPlanStep";
|
||||
|
||||
// Signup-Screens nach Davids Subframe-"WF-P2"-Designs:
|
||||
// S01 "Signup" -> Form (Logo + Card "Konto erstellen": E-Mail, Passwort+Staerke, Vor-/Nachname,
|
||||
@@ -26,32 +26,74 @@ import { getPasswordChecks, type PasswordPolicy } from "~/modules/users/componen
|
||||
// Token-genaue Uebernahme + bewusste Abweichungen (vom Backend erzwungen, nicht erfunden):
|
||||
// - Davids S01 zeigt das Passwort IMMER. Bei aktiver E-Mail-Verifizierung sammelt das Backend das Passwort
|
||||
// aber erst beim Verify (Registration-Modell hat KEINE Passwort-Spalte) -> showPasswordInput bleibt
|
||||
// `!requireEmailVerification` (Default ist OFF -> Passwort sichtbar = Davids Optik). [Backend-Flag]
|
||||
// `!requireEmailVerification` (launch-sicherer Default ist ON -> Passwort genau einmal im Verify-Schritt).
|
||||
// Eine explizit deaktivierte Verifizierung zeigt das Passwort weiterhin direkt in S01. [Backend-Flag]
|
||||
// - Davids S01 hat KEIN Telefon-/USt-IdNr-Feld -> entfernt (wurden ohnehin nie persistiert).
|
||||
// - Davids S01 hat 2 Consents (AGB, Datenschutz); der separate AVV/DPA-Consent wurde gestrichen. [Flag]
|
||||
// - Davids PasswordStrengthIndicator existiert nicht in ~/ui -> bestehender Progress-Balken beibehalten.
|
||||
// - Davids statische Captcha-Box ("Ich bin kein Roboter") -> echtes mCaptcha-Widget in Davids Box-Optik,
|
||||
// nur sichtbar wenn Captcha aktiv ist.
|
||||
// - S03 "E-Mail erneut senden": echtes Resend braucht `recreateToken:true` (registerFromRequest nutzt
|
||||
// `false` -> versendet bei bestehender Registration NICHTS). Button postet `intent=resendVerification`;
|
||||
// das Backend muss diesen Intent noch auf createRegistrationForm({recreateToken:true}) mappen. [Backend-Flag]
|
||||
// - S03 resend posts `intent=resendVerification`. The server verifies the persisted HMAC-bound pending
|
||||
// capability, rotates its token and TTL atomically, and returns the new request key for the next click.
|
||||
|
||||
type RegisterData = { company?: string; firstName?: string; lastName?: string; email?: string; slug?: string };
|
||||
|
||||
export type RegistrationPlanOptionData = {
|
||||
readonly planId: string;
|
||||
readonly planCode: string;
|
||||
readonly titleKey: string;
|
||||
readonly descriptionKey: string;
|
||||
readonly priceId: string;
|
||||
readonly amountCents: number;
|
||||
readonly baseAmountCents: number;
|
||||
readonly currency: string;
|
||||
readonly billingPeriod: number;
|
||||
readonly includedOfficeSeatQuantity: number;
|
||||
readonly includedFieldSeatQuantity: number;
|
||||
readonly includedStorageGb: number;
|
||||
readonly storagePerAdditionalSeatGb: number;
|
||||
readonly extraOfficeSeatQuantity: number;
|
||||
readonly extraFieldSeatQuantity: number;
|
||||
readonly recommended: boolean;
|
||||
};
|
||||
|
||||
type RegistrationPlanAdviceData = {
|
||||
readonly plans: readonly RegistrationPlanOptionData[];
|
||||
readonly selectedPriceId: string;
|
||||
readonly recommendedPriceId: string;
|
||||
readonly officeSeatQuantity: number;
|
||||
readonly fieldSeatQuantity: number;
|
||||
};
|
||||
|
||||
export default function RegisterScreen({
|
||||
requireCaptcha = false,
|
||||
error,
|
||||
captchaResetKey,
|
||||
verificationEmailSent,
|
||||
data = {},
|
||||
leadConversion,
|
||||
passwordPolicy,
|
||||
creationRequestKey,
|
||||
subscriptionPlans,
|
||||
selectedSubscriptionPriceId,
|
||||
recommendedSubscriptionPriceId,
|
||||
initialOfficeSeatQuantity,
|
||||
initialFieldSeatQuantity,
|
||||
}: {
|
||||
requireCaptcha?: boolean;
|
||||
error?: string;
|
||||
/** Changes after every failed initial submit so single-use CAPTCHA proofs cannot poison retries. */
|
||||
captchaResetKey?: string;
|
||||
verificationEmailSent?: boolean;
|
||||
data?: RegisterData;
|
||||
leadConversion?: { leadId: string; token: string; planId?: string | null };
|
||||
passwordPolicy?: PasswordPolicy;
|
||||
creationRequestKey: string;
|
||||
subscriptionPlans: readonly RegistrationPlanOptionData[];
|
||||
selectedSubscriptionPriceId: string;
|
||||
recommendedSubscriptionPriceId: string;
|
||||
initialOfficeSeatQuantity: number;
|
||||
initialFieldSeatQuantity: number;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { appConfiguration, csrf } = useRootData();
|
||||
@@ -60,6 +102,8 @@ export default function RegisterScreen({
|
||||
const [searchParams] = useSearchParams();
|
||||
const isSubmitting = navigation.state !== "idle";
|
||||
const redirect = searchParams.get("redirect") ?? "";
|
||||
const formRef = useRef<HTMLFormElement>(null);
|
||||
const passwordInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
// Controlled, damit Werte ueber den Wechsel Form <-> "E-Mail bestaetigt"-Status erhalten bleiben
|
||||
// (E-Mail-Anzeige in S03, Resend ohne erneutes Tippen).
|
||||
@@ -68,21 +112,96 @@ export default function RegisterScreen({
|
||||
const [company, setCompany] = useState(data.company ?? "");
|
||||
const [firstName, setFirstName] = useState(data.firstName ?? "");
|
||||
const [lastName, setLastName] = useState(data.lastName ?? "");
|
||||
const [selectedPriceId, setSelectedPriceId] = useState(selectedSubscriptionPriceId);
|
||||
const [step, setStep] = useState<"account" | "team" | "plan">("account");
|
||||
const [officeSeatQuantity, setOfficeSeatQuantity] = useState(initialOfficeSeatQuantity);
|
||||
const [fieldSeatQuantity, setFieldSeatQuantity] = useState(initialFieldSeatQuantity);
|
||||
const [planOptions, setPlanOptions] = useState(subscriptionPlans);
|
||||
const [recommendedPriceId, setRecommendedPriceId] = useState(recommendedSubscriptionPriceId);
|
||||
const [planManuallyOverridden, setPlanManuallyOverridden] = useState(selectedSubscriptionPriceId !== recommendedSubscriptionPriceId);
|
||||
const [planAdviceLoading, setPlanAdviceLoading] = useState(false);
|
||||
const [planAdviceFailed, setPlanAdviceFailed] = useState(false);
|
||||
const [planAdviceRetryKey, setPlanAdviceRetryKey] = useState(0);
|
||||
const [acceptTerms, setAcceptTerms] = useState(false);
|
||||
const [acceptPrivacy, setAcceptPrivacy] = useState(false);
|
||||
const allConsents = acceptTerms && acceptPrivacy;
|
||||
const [captchaStatus, setCaptchaStatus] = useState<"pending" | "solved" | "error">("pending");
|
||||
const [passwordValidationRequested, setPasswordValidationRequested] = useState(false);
|
||||
|
||||
const requireEmailVerification = appConfiguration.auth.requireEmailVerification;
|
||||
const showPasswordInput = !requireEmailVerification;
|
||||
const captchaEnabled = requireCaptcha && appConfiguration.auth.captcha.enabled;
|
||||
const checks = useMemo(() => getPasswordChecks(password, passwordPolicy), [password, passwordPolicy]);
|
||||
const strength = checks.length === 0 ? 0 : Math.round((checks.filter((c) => c.valid).length / checks.length) * 100);
|
||||
const passwordMeetsClientPolicy = !showPasswordInput || checks.length === 0 || checks.every((check) => check.valid);
|
||||
const showPasswordPolicyError = passwordValidationRequested && !passwordMeetsClientPolicy;
|
||||
|
||||
useEffect(() => {
|
||||
if (captchaResetKey) setCaptchaStatus("pending");
|
||||
}, [captchaResetKey]);
|
||||
|
||||
useEffect(() => {
|
||||
if (verificationEmailSent) return;
|
||||
if (
|
||||
!Number.isSafeInteger(officeSeatQuantity) ||
|
||||
!Number.isSafeInteger(fieldSeatQuantity) ||
|
||||
officeSeatQuantity < 1 ||
|
||||
officeSeatQuantity > 10_000 ||
|
||||
fieldSeatQuantity < 0 ||
|
||||
fieldSeatQuantity > 10_000
|
||||
) {
|
||||
setPlanAdviceFailed(true);
|
||||
return;
|
||||
}
|
||||
const controller = new AbortController();
|
||||
const timer = window.setTimeout(async () => {
|
||||
setPlanAdviceLoading(true);
|
||||
setPlanAdviceFailed(false);
|
||||
try {
|
||||
const params = new URLSearchParams({ office: String(officeSeatQuantity), field: String(fieldSeatQuantity) });
|
||||
const response = await fetch(`/auth/registration-plan-advice?${params}`, {
|
||||
headers: { Accept: "application/json" },
|
||||
signal: controller.signal,
|
||||
});
|
||||
if (!response.ok) throw new Error("Registration plan advice failed");
|
||||
const advice = (await response.json()) as RegistrationPlanAdviceData;
|
||||
setPlanOptions(advice.plans);
|
||||
setRecommendedPriceId(advice.recommendedPriceId);
|
||||
if (!planManuallyOverridden) setSelectedPriceId(advice.recommendedPriceId);
|
||||
} catch {
|
||||
if (!controller.signal.aborted) setPlanAdviceFailed(true);
|
||||
} finally {
|
||||
if (!controller.signal.aborted) setPlanAdviceLoading(false);
|
||||
}
|
||||
}, 250);
|
||||
return () => {
|
||||
window.clearTimeout(timer);
|
||||
controller.abort();
|
||||
};
|
||||
}, [fieldSeatQuantity, officeSeatQuantity, planAdviceRetryKey, planManuallyOverridden, verificationEmailSent]);
|
||||
|
||||
function showTeamStep() {
|
||||
setPasswordValidationRequested(true);
|
||||
const accountStep = formRef.current?.querySelector('[data-ui-id="ui.auth.register.accountStep"]');
|
||||
if (!accountStep) return;
|
||||
const controls = Array.from(accountStep.querySelectorAll<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>("input, select, textarea"));
|
||||
const nativeFieldsValid = controls.every((control) => control.reportValidity());
|
||||
if (!passwordMeetsClientPolicy) {
|
||||
passwordInputRef.current?.focus();
|
||||
return;
|
||||
}
|
||||
if (nativeFieldsValid) setStep("team");
|
||||
}
|
||||
|
||||
function selectPlan(priceId: string) {
|
||||
setPlanManuallyOverridden(true);
|
||||
setSelectedPriceId(priceId);
|
||||
}
|
||||
|
||||
// S03 "E-Mail bestaetigen" — Davids Status-Card.
|
||||
if (verificationEmailSent) {
|
||||
return (
|
||||
<div
|
||||
className="flex min-h-screen w-full flex-col items-center justify-center gap-8 bg-surface-neutral-primary px-4 py-12 mobile:gap-6 mobile:py-6"
|
||||
className="bg-surface-neutral-primary mobile:gap-6 mobile:py-6 flex min-h-screen w-full flex-col items-center justify-center gap-8 px-4 py-12"
|
||||
data-ui-id="ui.auth.register.verificationSent"
|
||||
>
|
||||
<Logo size="64" />
|
||||
@@ -91,28 +210,46 @@ export default function RegisterScreen({
|
||||
<IconWithBackground variant="information" size="large" round={true} icon={<FeatherMailCheck />} />
|
||||
<div className="flex w-full flex-col items-center gap-2">
|
||||
<span className="text-heading- font-heading- text-text-neutral-primary text-center">{t("account.verify.confirmEmailTitle")}</span>
|
||||
<span className="w-full text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary text-center">
|
||||
<span className="text-body-small-regular-150 font-body-small-regular-150 text-text-neutral-tertiary w-full text-center">
|
||||
{t("account.verify.confirmEmailBody")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex w-full flex-col items-center gap-2 rounded-md border border-solid border-border-default bg-surface-neutral-primary px-4 py-3">
|
||||
<span className="text-body-extra-small-medium-150 font-body-extra-small-medium-150 text-text-neutral-tertiary">{t("account.verify.linkSentTo")}</span>
|
||||
<span className="w-full text-body-default-semibold-0 font-body-default-semibold-0 text-text-neutral-primary text-center" data-ui-id="ui.auth.register.sentEmail">
|
||||
<div className="border-border-default bg-surface-neutral-primary flex w-full flex-col items-center gap-2 rounded-md border border-solid px-4 py-3">
|
||||
<span className="text-body-extra-small-medium-150 font-body-extra-small-medium-150 text-text-neutral-tertiary">
|
||||
{t("account.verify.linkSentTo")}
|
||||
</span>
|
||||
<span
|
||||
className="text-body-default-semibold-0 font-body-default-semibold-0 text-text-neutral-primary w-full text-center"
|
||||
data-ui-id="ui.auth.register.sentEmail"
|
||||
>
|
||||
{email}
|
||||
</span>
|
||||
</div>
|
||||
<Alert variant="neutral" notDismissible={true} title="" description={t("account.verify.checkInboxHint")} />
|
||||
{error && navigation.state === "idle" ? (
|
||||
<p
|
||||
className="text-body-small-regular-0 font-body-small-regular-0 text-text-feedback-negative text-center"
|
||||
role="alert"
|
||||
data-ui-id="ui.auth.register.resendError"
|
||||
>
|
||||
{error}
|
||||
</p>
|
||||
) : null}
|
||||
<div className="flex w-full flex-col items-center gap-3">
|
||||
{/* Resend: echtes Re-Send ist backend-seitig offen (recreateToken:true) -> Intent posten + Flag. */}
|
||||
{/* The resend intent proves the persisted HMAC-bound pending capability; the server rotates token and TTL before queueing a new mail job. */}
|
||||
<Form method="post" className="w-full">
|
||||
<input type="hidden" name="csrf" value={csrf} readOnly />
|
||||
<input type="hidden" name="redirectTo" value={redirect} readOnly />
|
||||
<input type="hidden" name="intent" value="resendVerification" readOnly />
|
||||
<input type="hidden" name="creationRequestKey" value={creationRequestKey} readOnly />
|
||||
<input type="hidden" name="email" value={email} readOnly />
|
||||
<input type="hidden" name="company" value={company} readOnly />
|
||||
<input type="hidden" name="first-name" value={firstName} readOnly />
|
||||
<input type="hidden" name="last-name" value={lastName} readOnly />
|
||||
<input type="hidden" name="selectedSubscriptionPriceId" value={selectedPriceId} readOnly />
|
||||
<input type="hidden" name="selectedOfficeSeatQuantity" value={officeSeatQuantity} readOnly />
|
||||
<input type="hidden" name="selectedFieldSeatQuantity" value={fieldSeatQuantity} readOnly />
|
||||
{leadConversion ? (
|
||||
<>
|
||||
<input type="hidden" name="leadId" value={leadConversion.leadId} readOnly />
|
||||
@@ -135,7 +272,7 @@ export default function RegisterScreen({
|
||||
className="h-10 w-full flex-none"
|
||||
variant="secondary"
|
||||
icon={<FeatherPencil />}
|
||||
onClick={() => navigate("/signup")}
|
||||
onClick={() => navigate("/signup?restart=1")}
|
||||
data-ui-id="ui.auth.register.changeEmail"
|
||||
>
|
||||
{t("account.verify.changeEmail")}
|
||||
@@ -149,7 +286,7 @@ export default function RegisterScreen({
|
||||
</Link>
|
||||
</div>
|
||||
</Card>
|
||||
<span className="text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-tertiary text-center max-w-[400px]">
|
||||
<span className="text-body-extra-small-regular-150 font-body-extra-small-regular-150 text-text-neutral-tertiary max-w-[400px] text-center">
|
||||
{t("account.verify.linkValidityNote")}
|
||||
</span>
|
||||
</div>
|
||||
@@ -159,8 +296,17 @@ export default function RegisterScreen({
|
||||
// S01 "Signup".
|
||||
return (
|
||||
<AuthShell
|
||||
title={t("account.register.title")}
|
||||
subtitle={t("account.register.signupSubtitle")}
|
||||
title={step === "account" ? t("account.register.title") : step === "team" ? t("account.register.teamStepTitle") : t("account.register.planStepTitle")}
|
||||
subtitle={
|
||||
step === "account"
|
||||
? t("account.register.signupSubtitle")
|
||||
: step === "team"
|
||||
? t("account.register.teamStepSubtitle")
|
||||
: t("account.register.planStepSubtitle")
|
||||
}
|
||||
cardSize={step === "account" ? "large" : "extra-large"}
|
||||
cardClassName={step === "account" ? "max-w-[448px]" : "max-w-[960px]"}
|
||||
logoSize="32"
|
||||
dataUiId="ui.auth.register.page"
|
||||
footer={
|
||||
<>
|
||||
@@ -174,9 +320,27 @@ export default function RegisterScreen({
|
||||
}
|
||||
>
|
||||
{appConfiguration.auth.authMethods.emailPassword.enabled ? (
|
||||
<Form method="post" noValidate className="flex w-full flex-col gap-4" data-ui-id="ui.auth.register.form">
|
||||
<Form ref={formRef} method="post" className="flex w-full flex-col gap-4" data-ui-id="ui.auth.register.form">
|
||||
<StepperHorizontal className="pb-1" data-ui-id="ui.auth.register.steps">
|
||||
<StepperHorizontal.Step
|
||||
firstStep
|
||||
variant={step === "account" ? "active" : "completed"}
|
||||
stepNumber="1"
|
||||
label={t("account.register.accountStepLabel")}
|
||||
/>
|
||||
<StepperHorizontal.Step
|
||||
variant={step === "team" ? "active" : step === "plan" ? "completed" : "default"}
|
||||
stepNumber="2"
|
||||
label={t("account.register.teamStepLabel")}
|
||||
/>
|
||||
<StepperHorizontal.Step lastStep variant={step === "plan" ? "active" : "default"} stepNumber="3" label={t("account.register.planStepLabel")} />
|
||||
</StepperHorizontal>
|
||||
<input type="hidden" name="redirectTo" value={redirect} readOnly />
|
||||
<input type="hidden" name="csrf" value={csrf} readOnly />
|
||||
<input type="hidden" name="creationRequestKey" value={creationRequestKey} readOnly />
|
||||
<input type="hidden" name="selectedSubscriptionPriceId" value={selectedPriceId} readOnly />
|
||||
<input type="hidden" name="acceptTerms" value={acceptTerms ? "true" : "false"} readOnly />
|
||||
<input type="hidden" name="acceptPrivacy" value={acceptPrivacy ? "true" : "false"} readOnly />
|
||||
{leadConversion ? (
|
||||
<>
|
||||
<input type="hidden" name="leadId" value={leadConversion.leadId} readOnly />
|
||||
@@ -185,151 +349,180 @@ export default function RegisterScreen({
|
||||
</>
|
||||
) : null}
|
||||
|
||||
{/* Davids Felder-Gruppe (gap-4). */}
|
||||
<div className="flex w-full flex-col items-start gap-4">
|
||||
<TextInput className="h-auto w-full flex-none" fillContainer showLabel label={t("account.shared.email")} type="email">
|
||||
<TextInput.Input
|
||||
name="email"
|
||||
type="email"
|
||||
required
|
||||
autoComplete="email"
|
||||
placeholder={t("account.shared.emailPlaceholder")}
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
readOnly={Boolean(leadConversion)}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.email"
|
||||
/>
|
||||
</TextInput>
|
||||
<div className={step === "account" ? "flex w-full flex-col gap-4" : "hidden"} data-ui-id="ui.auth.register.accountStep">
|
||||
{/* Davids Felder-Gruppe (gap-4). */}
|
||||
<div className="flex w-full flex-col items-start gap-4">
|
||||
<TextInput className="h-auto w-full flex-none" fillContainer showLabel label={t("account.shared.email")} type="email">
|
||||
<TextInput.Input
|
||||
name="email"
|
||||
type="email"
|
||||
required
|
||||
autoComplete="email"
|
||||
placeholder={t("account.shared.emailPlaceholder")}
|
||||
value={email}
|
||||
onChange={(event) => setEmail(event.target.value)}
|
||||
readOnly={Boolean(leadConversion)}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.email"
|
||||
/>
|
||||
</TextInput>
|
||||
|
||||
{showPasswordInput ? (
|
||||
<div className="flex w-full flex-col items-start gap-2">
|
||||
<TextInput className="h-auto w-full flex-none" fillContainer showLabel label={t("account.shared.password")} type="password">
|
||||
<TextInput.Input
|
||||
name="password"
|
||||
{showPasswordInput ? (
|
||||
<div className="flex w-full flex-col items-start gap-2">
|
||||
<TextInput
|
||||
className="h-auto w-full flex-none"
|
||||
fillContainer
|
||||
showLabel
|
||||
label={t("account.shared.password")}
|
||||
type="password"
|
||||
required
|
||||
autoComplete="new-password"
|
||||
placeholder={t("account.register.passwordChoosePlaceholder")}
|
||||
value={password}
|
||||
onChange={(event) => setPassword(event.target.value)}
|
||||
error={showPasswordPolicyError}
|
||||
message={
|
||||
showPasswordPolicyError ? (
|
||||
<span id="registration-password-policy-error" role="alert" data-ui-id="ui.auth.register.passwordPolicyError">
|
||||
{t("account.register.passwordRequirements.fixBeforeContinue")}
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<TextInput.Input
|
||||
ref={passwordInputRef}
|
||||
name="password"
|
||||
type="password"
|
||||
required
|
||||
autoComplete="new-password"
|
||||
placeholder={t("account.register.passwordChoosePlaceholder")}
|
||||
value={password}
|
||||
onChange={(event) => {
|
||||
setPassword(event.target.value);
|
||||
if (passwordValidationRequested) setPasswordValidationRequested(false);
|
||||
}}
|
||||
onBlur={() => {
|
||||
if (password.length > 0 && !passwordMeetsClientPolicy) setPasswordValidationRequested(true);
|
||||
}}
|
||||
aria-invalid={showPasswordPolicyError}
|
||||
aria-describedby={showPasswordPolicyError ? "registration-password-policy-error" : undefined}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.password"
|
||||
/>
|
||||
</TextInput>
|
||||
{passwordPolicy ? (
|
||||
<>
|
||||
<Progress className="h-auto w-full flex-none" hideLabel label={t("account.register.passwordStrength")} value={strength} />
|
||||
<span className="text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-tertiary">
|
||||
{t("account.register.passwordStrength")}
|
||||
</span>
|
||||
<ul
|
||||
className="text-body-extra-small-regular-150 font-body-extra-small-regular-150 flex w-full flex-col gap-1"
|
||||
aria-live="polite"
|
||||
aria-label={t("account.register.passwordRequirements.label")}
|
||||
data-ui-id="ui.auth.register.passwordRequirements"
|
||||
>
|
||||
{checks.map((check) => {
|
||||
const label = t(check.label, check.args);
|
||||
const status = check.valid ? t("account.register.passwordRequirements.met") : t("account.register.passwordRequirements.notMet");
|
||||
return (
|
||||
<li
|
||||
key={check.key}
|
||||
className={
|
||||
check.valid
|
||||
? "text-text-feedback-positive"
|
||||
: showPasswordPolicyError
|
||||
? "text-text-feedback-negative"
|
||||
: "text-text-neutral-tertiary"
|
||||
}
|
||||
aria-label={`${status}: ${label}`}
|
||||
>
|
||||
<span aria-hidden="true">{check.valid ? "[x]" : "[ ]"}</span> {label}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="mobile:flex-col flex w-full items-start gap-4">
|
||||
<TextInput className="h-auto shrink-0 grow basis-0" showLabel label={t("models.user.firstName")}>
|
||||
<TextInput.Input
|
||||
name="first-name"
|
||||
required={appConfiguration.auth.requireName}
|
||||
placeholder={t("account.shared.firstNamePlaceholder")}
|
||||
value={firstName}
|
||||
onChange={(event) => setFirstName(event.target.value)}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.password"
|
||||
data-ui-id="ui.auth.register.firstName"
|
||||
/>
|
||||
</TextInput>
|
||||
<TextInput className="h-auto shrink-0 grow basis-0" showLabel label={t("models.user.lastName")}>
|
||||
<TextInput.Input
|
||||
name="last-name"
|
||||
required={appConfiguration.auth.requireName}
|
||||
placeholder={t("account.shared.lastNamePlaceholder")}
|
||||
value={lastName}
|
||||
onChange={(event) => setLastName(event.target.value)}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.lastName"
|
||||
/>
|
||||
</TextInput>
|
||||
{passwordPolicy ? (
|
||||
<>
|
||||
<Progress className="h-auto w-full flex-none" hideLabel value={strength} />
|
||||
<span className="text-body-small-medium-0 font-body-small-medium-0 text-text-neutral-tertiary">{t("account.register.passwordStrength")}</span>
|
||||
<span className="w-full text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-tertiary">{t("account.register.passwordHint")}</span>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="flex w-full items-start gap-4 mobile:flex-col">
|
||||
<TextInput className="h-auto grow shrink-0 basis-0" showLabel label={t("models.user.firstName")}>
|
||||
<TextInput className="h-auto w-full flex-none" fillContainer showLabel label={t("account.register.companyLabel")} icon={<FeatherBuilding />}>
|
||||
<TextInput.Input
|
||||
name="first-name"
|
||||
placeholder={t("account.shared.firstNamePlaceholder")}
|
||||
value={firstName}
|
||||
onChange={(event) => setFirstName(event.target.value)}
|
||||
name="company"
|
||||
required={appConfiguration.auth.requireOrganization}
|
||||
placeholder={t("account.register.companyPlaceholder")}
|
||||
value={company}
|
||||
onChange={(event) => setCompany(event.target.value)}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.firstName"
|
||||
/>
|
||||
</TextInput>
|
||||
<TextInput className="h-auto grow shrink-0 basis-0" showLabel label={t("models.user.lastName")}>
|
||||
<TextInput.Input
|
||||
name="last-name"
|
||||
placeholder={t("account.shared.lastNamePlaceholder")}
|
||||
value={lastName}
|
||||
onChange={(event) => setLastName(event.target.value)}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.lastName"
|
||||
data-ui-id="ui.auth.register.company"
|
||||
/>
|
||||
</TextInput>
|
||||
</div>
|
||||
|
||||
<TextInput
|
||||
className="h-auto w-full flex-none"
|
||||
fillContainer
|
||||
showLabel
|
||||
label={t("account.register.companyLabel")}
|
||||
icon={<FeatherBuilding />}
|
||||
>
|
||||
<TextInput.Input
|
||||
name="company"
|
||||
required={appConfiguration.auth.requireOrganization}
|
||||
placeholder={t("account.register.companyPlaceholder")}
|
||||
value={company}
|
||||
onChange={(event) => setCompany(event.target.value)}
|
||||
disabled={isSubmitting}
|
||||
data-ui-id="ui.auth.register.company"
|
||||
/>
|
||||
</TextInput>
|
||||
</div>
|
||||
|
||||
{/* Sicherheitspruefung — Davids Box mit echtem mCaptcha-Widget statt statischer Mock-Checkbox. */}
|
||||
{captchaEnabled ? (
|
||||
<div className="flex w-full flex-col items-start gap-2">
|
||||
<span className="text-body-extra-small-semibold-0 font-body-extra-small-semibold-0 uppercase text-text-neutral-tertiary">
|
||||
{t("account.register.securityCheck")}
|
||||
</span>
|
||||
<div className="flex w-full items-center justify-center rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-4 py-3">
|
||||
<Captcha
|
||||
enabled
|
||||
provider={appConfiguration.auth.captcha.provider}
|
||||
instanceUrl={appConfiguration.auth.captcha.instanceUrl}
|
||||
sitekey={appConfiguration.auth.captcha.loginSiteKey}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{/* Consents — Davids 2 Checkboxen mit Prefix + Link. */}
|
||||
<div className="flex w-full flex-col items-start gap-3">
|
||||
<div className="flex w-full items-center gap-2">
|
||||
<Checkbox label={t("account.register.consentTerms")} hideLabel checked={acceptTerms} onCheckedChange={setAcceptTerms} data-ui-id="ui.auth.register.consentTerms" />
|
||||
<div className="flex min-h-5 flex-wrap items-center gap-1">
|
||||
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">{t("account.register.consentAcceptPrefix")}</span>
|
||||
<a href="/terms-and-conditions" target="_blank" rel="noreferrer" className="no-underline">
|
||||
<LinkButton size="small" hideIcon>
|
||||
{t("account.register.consentTermsLink")}
|
||||
</LinkButton>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex w-full items-center gap-2">
|
||||
<Checkbox label={t("account.register.consentPrivacy")} hideLabel checked={acceptPrivacy} onCheckedChange={setAcceptPrivacy} data-ui-id="ui.auth.register.consentPrivacy" />
|
||||
<div className="flex min-h-5 flex-wrap items-center gap-1">
|
||||
<span className="text-body-small-regular-0 font-body-small-regular-0 text-text-neutral-secondary">{t("account.register.consentAcceptPrefix")}</span>
|
||||
<a href="/privacy-policy" target="_blank" rel="noreferrer" className="no-underline">
|
||||
<LinkButton size="small" hideIcon>
|
||||
{t("account.register.privacyPolicy")}
|
||||
</LinkButton>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Button-Gruppe — Submit + Bestaetigungs-Mail-Hinweis (nur wenn verifiziert wird). */}
|
||||
<div className="flex w-full flex-col items-start gap-2">
|
||||
<Button type="submit" className="h-9 w-full flex-none" loading={isSubmitting} disabled={isSubmitting || !allConsents} data-ui-id="ui.auth.register.submit">
|
||||
{t("account.register.title")}
|
||||
<Button type="button" className="h-9 w-full flex-none" onClick={showTeamStep} data-ui-id="ui.auth.register.toTeamStep">
|
||||
{t("account.register.continueToTeam")}
|
||||
</Button>
|
||||
{requireEmailVerification ? (
|
||||
<div className="flex w-full items-center justify-center gap-1">
|
||||
<FeatherMail className="text-body-small-regular-0 font-body-small-regular-0 text-icon-neutral-tertiary" />
|
||||
<span className="text-body-extra-small-regular-0 font-body-extra-small-regular-0 text-text-neutral-tertiary">{t("account.register.confirmationEmailNote")}</span>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{error && navigation.state === "idle" ? (
|
||||
<p className="text-center text-body-small-regular-0 font-body-small-regular-0 text-text-feedback-negative" role="alert">
|
||||
{error}
|
||||
</p>
|
||||
) : null}
|
||||
<RegistrationPlanStep
|
||||
visible={step !== "account"}
|
||||
screen={step === "team" ? "team" : "plan"}
|
||||
plans={planOptions}
|
||||
selectedPriceId={selectedPriceId}
|
||||
recommendedPriceId={recommendedPriceId}
|
||||
officeSeatQuantity={officeSeatQuantity}
|
||||
fieldSeatQuantity={fieldSeatQuantity}
|
||||
planAdviceLoading={planAdviceLoading}
|
||||
planAdviceFailed={planAdviceFailed}
|
||||
isSubmitting={isSubmitting}
|
||||
acceptTerms={acceptTerms}
|
||||
acceptPrivacy={acceptPrivacy}
|
||||
captchaEnabled={captchaEnabled}
|
||||
captchaConfig={appConfiguration.auth.captcha}
|
||||
captchaResetKey={captchaResetKey}
|
||||
captchaStatus={captchaStatus}
|
||||
requireEmailVerification={requireEmailVerification}
|
||||
error={navigation.state === "idle" ? error : undefined}
|
||||
onSelectPlan={selectPlan}
|
||||
onOfficeSeatQuantityChange={setOfficeSeatQuantity}
|
||||
onFieldSeatQuantityChange={setFieldSeatQuantity}
|
||||
onAcceptTermsChange={setAcceptTerms}
|
||||
onAcceptPrivacyChange={setAcceptPrivacy}
|
||||
onCaptchaStatusChange={setCaptchaStatus}
|
||||
onRetryPlanAdvice={() => {
|
||||
setPlanAdviceFailed(false);
|
||||
setPlanAdviceRetryKey((current) => current + 1);
|
||||
}}
|
||||
onContinue={() => setStep("plan")}
|
||||
onBack={() => setStep(step === "plan" ? "team" : "account")}
|
||||
/>
|
||||
{/* The interactive seat controls live only on the team step and are
|
||||
unmounted on the final plan step. Keep the submitted contract
|
||||
present for the whole wizard so server-side price validation
|
||||
always receives the exact quantities the customer reviewed. */}
|
||||
<input type="hidden" name="selectedOfficeSeatQuantity" value={officeSeatQuantity} readOnly />
|
||||
<input type="hidden" name="selectedFieldSeatQuantity" value={fieldSeatQuantity} readOnly />
|
||||
</Form>
|
||||
) : null}
|
||||
</AuthShell>
|
||||
|
||||
Reference in new issue
Block a user