mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-09 15:22:39 +02:00
add regex agent name validation
This commit is contained in:
parent
0b0db41d55
commit
bdc047cde5
1 changed files with 4 additions and 0 deletions
|
|
@ -59,6 +59,10 @@ export function AgentConfig({
|
|||
if (usedAgentNames.has(value)) {
|
||||
return { valid: false, errorMessage: "This name is already taken" };
|
||||
}
|
||||
// validate against this regex: ^[a-zA-Z0-9_-]+$
|
||||
if (!/^[a-zA-Z0-9_-\s]+$/.test(value)) {
|
||||
return { valid: false, errorMessage: "Name must contain only letters, numbers, underscores, hyphens, and spaces" };
|
||||
}
|
||||
return { valid: true };
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue