Make the auth screen's password field optional; catch up UserManagement drift

AuthPage's password (and, in setup mode, confirm-password) field no
longer forces a non-empty value client-side -- the server already
enforces the real rules (a correct password to log in, >=8 chars to
register/bootstrap), so this only replaces a native browser validation
popup with the server's own error message.

Also bring UserManagement in line with an AuthGuard-only edit that had
drifted ahead of this source (username/email/password relaxed to "at
least one of username/email, password optional" for admin-created
users) so the next consumer sync doesn't silently revert it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Gabriel20xxandClaude Sonnet 5 committed 2026-09-09 16:52:45 +02:00
1 parent ae792cbf43
commit 56e2f60531
3 files changed
+14 -5

No files matched your search

@@ -201,7 +201,6 @@
class="sc-input"
minlength="8"
name="password"
required
type="password"
bind:value={password}
/>
@@ -229,7 +228,6 @@
class="sc-input"
minlength="8"
name="confirmPassword"
required
type="password"
bind:value={confirmPassword}
/>
@@ -72,6 +72,10 @@
async function createUser(event: SubmitEvent): Promise<void> {
event.preventDefault();
if (!onCreate) return;
if (!newUser.username.trim() && !newUser.email.trim()) {
error = 'A username or email is required.';
return;
}
saving = true;
error = '';
notice = '';
@@ -152,9 +156,9 @@
<form class="sc-user-form" onsubmit={createUser}>
<strong>Add user</strong>
<div class="sc-user-grid">
<input aria-label="New username" class="sc-input" placeholder="Username" required type="text" bind:value={newUser.username} />
<input aria-label="New email" class="sc-input" placeholder="Email" required type="email" bind:value={newUser.email} />
<input aria-label="New password" class="sc-input" minlength="8" placeholder="Password" required type="password" bind:value={newUser.password} />
<input aria-label="New username" class="sc-input" placeholder="Username (optional if email is set)" type="text" bind:value={newUser.username} />
<input aria-label="New email" class="sc-input" placeholder="Email (optional if username is set)" type="email" bind:value={newUser.email} />
<input aria-label="New password" class="sc-input" minlength="8" placeholder="Password (optional)" type="password" bind:value={newUser.password} />
<select aria-label="New role" class="sc-input" disabled={!canAssignAdmin} bind:value={newUser.role}>
<option value="user">User</option>
{#if canAssignAdmin}<option value="admin">Admin</option>{/if}