Reduce min name length

This commit is contained in:
2025-09-14 17:57:24 +02:00
parent 5c66430cb4
commit 527c9b7428
4 changed files with 29 additions and 4 deletions
+19 -1
View File
@@ -2,6 +2,7 @@
import { parseError } from '#shared/utils/error';
const { t } = useI18n();
const validation = useValidation();
const emits = defineEmits<{
update: [];
}>();
@@ -47,6 +48,7 @@ async function submit() {
}
pending.value = false;
}
// TODO: translate
</script>
<template>
@@ -56,13 +58,29 @@ async function submit() {
<VaModal v-model="isOpen" close-button hide-default-actions>
<h3 class="text-3xl">Create a new team</h3>
<div class="mt-4 flex flex-col gap-4">
<VaInput v-model="data.name" label="Name" placeholder="My cool team" />
<VaInput
v-model="data.name"
label="Name"
placeholder="My cool team"
min-length="3"
max-length="256"
counter
:rules="[
validation.required('Name'),
validation.max('Name', 256),
validation.min('Name', 3)
]"
required
/>
<VaTextarea
v-model="data.description"
max-rows="4"
min-rows="2"
label="Description"
placeholder="The best team!"
max-length="256"
counter
:rules="[validation.maxOptional('Description', 256)]"
/>
<p>An invite code will be generated automatically.</p>
<VaAlert v-if="error" color="danger">{{ t(error) }}</VaAlert>
+7
View File
@@ -23,6 +23,13 @@ export default function () {
(value && value.length <= max) ||
t('validation.max_length', { name, max });
},
maxOptional(name: string, max = 64) {
return (value: string) =>
!value ||
value.length <= 0 ||
value.length <= max ||
t('validation.max_length', { name, max });
},
min(name: string, min = 8) {
return (value: string) =>
(value && value.length >= min) ||
+2 -2
View File
@@ -74,11 +74,11 @@ async function submit() {
:label="t('auth.name')"
:placeholder="t('auth.name')"
max-length="64"
min-length="5"
min-length="1"
:rules="[
validation.required(t('auth.name')),
validation.max(t('auth.name'), 64),
validation.min(t('auth.name'), 5)
validation.min(t('auth.name'), 1)
]"
required
>