fix: strip non-alphanumeric chars from admin username input
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:
4
ui/src/pages/vendor/CreateTenantPage.tsx
vendored
4
ui/src/pages/vendor/CreateTenantPage.tsx
vendored
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user