fix: strip non-alphanumeric chars from admin username input
All checks were successful
CI / build (push) Successful in 53s
CI / docker (push) Successful in 41s

Logto usernames must match alphanumeric regex. The form now strips
invalid characters on input and shows a hint about the constraint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-10 07:44:59 +02:00
parent 2dc75c4361
commit 3b345881c6

View File

@@ -91,11 +91,11 @@ export function CreateTenantPage() {
</select>
</FormField>
<FormField label="Admin Username" htmlFor="admin-user" hint="Initial tenant admin (owner role)">
<FormField label="Admin Username" htmlFor="admin-user" hint="Initial tenant admin (owner role). Alphanumeric only, no hyphens.">
<Input
id="admin-user"
value={adminUsername}
onChange={(e) => setAdminUsername(e.target.value)}
onChange={(e) => setAdminUsername(e.target.value.replace(/[^a-zA-Z0-9]/g, ''))}
placeholder="admin"
/>
</FormField>