Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

perf: improve the validation rules for username #868

Merged
merged 8 commits into from
Feb 23, 2023
12 changes: 11 additions & 1 deletion src/modules/system/users/components/UserEditingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,17 @@ const handleCreateUser = async () => {
label="用户名"
type="text"
name="name"
validation="required|alphanumeric|length:0,50"
:validation="[
['required'],
['length:0,63'],
[
'matches',
/^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/,
],
]"
:validation-messages="{
matches: '请输入有效的用户名',
}"
></FormKit>
<FormKit
id="displayNameInput"
Expand Down