🐛 fix(auth): require name field in registration forms

Add required name field (min 2 chars) to all registration forms to fix
Better Auth validation error. Updates backend DTO, shared-auth service,
shared-auth-ui RegisterPage component, i18n translations, and all app
auth stores and register pages.
This commit is contained in:
Wuesteon 2025-12-16 20:28:28 +01:00
parent 11324b5e68
commit d3e11b320a
28 changed files with 151 additions and 56 deletions

View file

@ -6,6 +6,7 @@
const dispatch = createEventDispatcher();
// Formular-Zustände
let name = '';
let email = '';
let password = '';
let confirmPassword = '';
@ -16,11 +17,16 @@
// Formular absenden
async function handleSubmit() {
// Validierung
if (!email || !password || !confirmPassword) {
if (!name || !email || !password || !confirmPassword) {
errorMessage = 'Bitte fülle alle Felder aus.';
return;
}
if (name.length < 2) {
errorMessage = 'Der Name muss mindestens 2 Zeichen lang sein.';
return;
}
if (password !== confirmPassword) {
errorMessage = 'Die Passwörter stimmen nicht überein.';
return;
@ -35,12 +41,13 @@
isLoading = true;
errorMessage = '';
const success = await AuthService.register(email, password);
const success = await AuthService.register(email, password, name);
if (success) {
successMessage =
'Registrierung erfolgreich! Bitte überprüfe deine E-Mails, um dein Konto zu bestätigen.';
// Formular zurücksetzen
name = '';
email = '';
password = '';
confirmPassword = '';
@ -83,6 +90,19 @@
{/if}
<form on:submit|preventDefault={handleSubmit}>
<div class="form-group">
<label for="name">Name</label>
<input
type="text"
id="name"
bind:value={name}
placeholder="Dein Name"
disabled={isLoading}
required
minlength="2"
/>
</div>
<div class="form-group">
<label for="email">E-Mail</label>
<input