Added opaque join-token support across backend and frontend: new migration/model/service/endpoints, guest controllers now resolve tokens, and the demo seeder seeds a token. Tenant event details list/manage tokens with copy/revoke actions, and the guest PWA uses tokens end-to-end (routing, storage, uploads, achievements, etc.). Docs TODO updated to reflect completed steps.
This commit is contained in:
@@ -20,6 +20,19 @@ interface RegisterFormProps {
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
type RegisterFormFields = {
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
password_confirmation: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
address: string;
|
||||
phone: string;
|
||||
privacy_consent: boolean;
|
||||
package_id: number | null;
|
||||
};
|
||||
|
||||
export default function RegisterForm({ packageId, onSuccess, privacyHtml, locale }: RegisterFormProps) {
|
||||
const [privacyOpen, setPrivacyOpen] = useState(false);
|
||||
const [hasTriedSubmit, setHasTriedSubmit] = useState(false);
|
||||
@@ -28,7 +41,7 @@ export default function RegisterForm({ packageId, onSuccess, privacyHtml, locale
|
||||
const page = usePage<{ errors: Record<string, string>; locale?: string; auth?: { user?: any | null } }>();
|
||||
const resolvedLocale = locale ?? page.props.locale ?? 'de';
|
||||
|
||||
const { data, setData, errors, clearErrors, reset, setError } = useForm({
|
||||
const { data, setData, errors, clearErrors, reset, setError } = useForm<RegisterFormFields>({
|
||||
username: '',
|
||||
email: '',
|
||||
password: '',
|
||||
@@ -91,10 +104,12 @@ export default function RegisterForm({ packageId, onSuccess, privacyHtml, locale
|
||||
const json = await response.json();
|
||||
const fieldErrors = json?.errors ?? {};
|
||||
Object.entries(fieldErrors).forEach(([key, message]) => {
|
||||
if (Array.isArray(message) && message.length > 0) {
|
||||
setError(key, message[0] as string);
|
||||
} else if (typeof message === 'string') {
|
||||
setError(key, message);
|
||||
if (key in data) {
|
||||
const fieldKey = key as keyof RegisterFormFields;
|
||||
const firstMessage = Array.isArray(message) ? (message[0] as string | undefined) : typeof message === 'string' ? message : undefined;
|
||||
if (firstMessage) {
|
||||
setError(fieldKey, firstMessage);
|
||||
}
|
||||
}
|
||||
});
|
||||
toast.error(t('register.validation_failed', 'Bitte pruefen Sie Ihre Eingaben.'));
|
||||
@@ -409,4 +424,3 @@ export default function RegisterForm({ packageId, onSuccess, privacyHtml, locale
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user