diff --git a/app/lib/server/functions/validateCustomFields.js b/app/lib/server/functions/validateCustomFields.js index fc3834f29fd6..403e1792dda7 100644 --- a/app/lib/server/functions/validateCustomFields.js +++ b/app/lib/server/functions/validateCustomFields.js @@ -37,7 +37,7 @@ export const validateCustomFields = function(fields) { throw new Meteor.Error('error-user-registration-custom-field', `Max length of field ${ fieldName } ${ field.maxLength }`, { method: 'registerUser' }); } - if (field.minLength && fieldValue.length < field.minLength) { + if (field.minLength && fieldValue.length > 0 && fieldValue.length < field.minLength) { throw new Meteor.Error('error-user-registration-custom-field', `Min length of field ${ fieldName } ${ field.minLength }`, { method: 'registerUser' }); } }); diff --git a/client/components/CustomFieldsForm.js b/client/components/CustomFieldsForm.js index 0653a6b168aa..bcd66c3f30bc 100644 --- a/client/components/CustomFieldsForm.js +++ b/client/components/CustomFieldsForm.js @@ -11,7 +11,7 @@ const CustomTextInput = ({ name, required, minLength, maxLength, setState, state const verify = useMemo(() => { const error = []; if (!state && required) { error.push(t('Field_required')); } - if (state.length < minLength) { error.push(t('Min_length_is', minLength)); } + if (state.length < minLength && state.length > 0) { error.push(t('Min_length_is', minLength)); } return error.join(', '); }, [state, required, minLength, t]);