[lib.field-manager] 'basic-name' 'url-name' cannot have trailing spaces
This commit is contained in:
parent
32f4e9a7b3
commit
1ea9a713b7
|
@ -15,12 +15,12 @@ FieldValidator.pushFormat('bypass', () => true);
|
|||
|
||||
/* (2) Basic name */
|
||||
FieldValidator.pushFormat('basic-name', (input) => {
|
||||
return typeof input === 'string' && /^[a-z0-9 _-]{3,20}$/i.test(input);
|
||||
return typeof input === 'string' && input.trim() === input && /^[a-z0-9 _-]{3,20}$/i.test(input);
|
||||
}, '3 characters required: letters, numbers, spaces, dots, hyphens');
|
||||
|
||||
/* (3) URL name */
|
||||
FieldValidator.pushFormat('url-name', (input) => {
|
||||
return typeof input === 'string' && /^[a-z0-9_-]{3,20}$/i.test(input);
|
||||
return typeof input === 'string' && input.trim() === input && /^[a-z0-9_-]{3,20}$/i.test(input);
|
||||
}, '3 characters required: letters, numbers, hyphens');
|
||||
|
||||
/* (4) Password */
|
||||
|
|
Loading…
Reference in New Issue