diff --git a/shared/src/bundles/users/enums/user-validation-message.enum.ts b/shared/src/bundles/users/enums/user-validation-message.enum.ts index ad735094d..95dd74f99 100644 --- a/shared/src/bundles/users/enums/user-validation-message.enum.ts +++ b/shared/src/bundles/users/enums/user-validation-message.enum.ts @@ -9,6 +9,7 @@ const UserValidationMessage = { WRONG_CREDENTIALS: 'Email or password are incorrect', USER_IS_NOT_AVAILABLE: 'User with this email already exists. Log in if it is you', + FULL_NAME_INVALID: 'Name must have at least two words', } as const; export { UserValidationMessage }; diff --git a/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts b/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts index 72a886780..92ffb5c3b 100644 --- a/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts +++ b/shared/src/bundles/users/validation-schemas/user-sign-up.validation-schema.ts @@ -49,6 +49,13 @@ const userSignUp = z .refine((data) => data.password === data.confirmPassword, { message: UserValidationMessage.PASS_DONT_MATCH, path: ['confirmPassword'], - }); + }) + .refine( + (data) => data.name.split(/\s+/).length >= 2, + { + message: UserValidationMessage.FULL_NAME_INVALID, + path: ['name'], + } + ); export { userSignUp };