fix(02): only letter and number username

This commit is contained in:
puriphatt 2024-08-29 14:07:43 +07:00
parent 30379bfe25
commit dc3e9ae0d1
4 changed files with 10 additions and 1 deletions

View file

@ -179,8 +179,14 @@ onMounted(async () => {
class="col-md col-12"
:label="$t('personnel.form.username')"
v-model="username"
:rules="[(val: string) => val.length > 2 || $t('form.error.required')]"
:rules="[
(val: string) => val.length > 2 || $t('form.error.required'),
(val: string) =>
(val.length > 0 && /^[a-zA-Z0-9]+$/.test(val)) ||
$t('form.error.letterAndNumOnly'),
]"
/>
<q-select
outlined
clearable