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>
|
</select>
|
||||||
</FormField>
|
</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
|
<Input
|
||||||
id="admin-user"
|
id="admin-user"
|
||||||
value={adminUsername}
|
value={adminUsername}
|
||||||
onChange={(e) => setAdminUsername(e.target.value)}
|
onChange={(e) => setAdminUsername(e.target.value.replace(/[^a-zA-Z0-9]/g, ''))}
|
||||||
placeholder="admin"
|
placeholder="admin"
|
||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|||||||
Reference in New Issue
Block a user