StefanPenchev05 / MyClothesV2

Welcome to MyClothes, where creativity meets fashion! This application provides a platform for designers to showcase their clothing products, receive feedback through comments and likes, engage in real-time chat, and even get hired by clients who love their work.
MIT License
0 stars 0 forks source link

Creating the Validator #10

Closed StefanPenchev05 closed 4 months ago

StefanPenchev05 commented 4 months ago

This task involves the creation of a Validator.js class that will serve as our gatekeeper, ensuring that the data entering our system is valid and meets our standards.

The Validator class will include the following methods:

isFirstAndLastName(first, last)

This method checks if the provided first and last names are valid. It ensures that the names are not empty and contain only alphabetic characters.

isEmail(value)

This asynchronous method validates if a given value is a valid email address. It uses a regular expression to check the format of the email and uses the dns module to verify that the domain in the email has DNS records.

isUsername(value)

This method checks if a given value is a valid username. It ensures that the username contains only alphanumeric characters, underscores, and hyphens.

isPassword(value)

This method validates a password based on several criteria including length, presence of uppercase and lowercase letters, numbers, special characters, and the absence of three repeating characters in a row.

Each method in the Validator class will be thoroughly tested to ensure it functions as expected. This will involve creating a variety of test cases to cover all possible scenarios.

This task is crucial for maintaining the integrity of our data and protecting our system from potential security threats.