perf: improve the validation rules for username

pull/868/head
Ryan Wang 2023-02-20 14:46:02 +08:00
parent 194ff7f4ad
commit e4d40533a0
1 changed files with 11 additions and 1 deletions

View File

@ -173,7 +173,17 @@ const handleCreateUser = async () => {
label="用户名"
type="text"
name="name"
validation="required|alphanumeric|length:0,50"
:validation="[
['required'],
['length:0,50'],
[
'matches',
/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-\_]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/,
],
]"
:validation-messages="{
matches: '请输入有效的用户名',
}"
></FormKit>
<FormKit
id="displayNameInput"