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

View file

@ -135,6 +135,7 @@ export default {
please: 'Please enter {msg} correct information.',
invalid: 'Invalid value.',
invalidCustomeMessage: 'Invalid value. {msg}',
letterAndNumOnly: 'Only letters and number are allowed',
},
warning: {
title: 'Warning {msg}',

View file

@ -135,6 +135,7 @@ export default {
please: 'โปรดใส่ข้อมูล{msg}ให้ถูกต้อง',
invalid: 'ข้อมูลไม่ถูกต้อง',
invalidCustomeMessage: 'ข้อมูลไม่ถูกต้อง {msg}',
letterAndNumOnly: 'โปรดใช้เฉพาะภาษาอังกฤษและตัวเลขเท่านั้น',
},
warning: {
title: 'แจ้งเตือน {msg}',

View file

@ -484,6 +484,7 @@ async function onDelete(id: string) {
typeStats.value = await userStore.typeStats();
flowStore.rotate();
},
cancel: () => {},
});
}