Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

refactor(ui): modify validation rules

robin9eff961ae007
diff --git a/ui/src/hooks/useUserModal/index.tsx b/ui/src/hooks/useUserModal/index.tsx
index dc3df9a5..8e7984a2 100644
--- a/ui/src/hooks/useUserModal/index.tsx
+++ b/ui/src/hooks/useUserModal/index.tsx
@@ -45,7 +45,10 @@ const useAddUserModal = (props: IProps = {}) => {
display_name: {
'ui:options': {
validator: (value) => {
- if (value.length > 30) {
+ const MIN_LENGTH = 4;
+ const MAX_LENGTH = 30;
+
+ if (value.length < MIN_LENGTH || value.length > MAX_LENGTH) {
return t('form.fields.display_name.msg');
}
return true;