Skip to content

Commit

Permalink
Merge pull request #129 from 0mahendra/firstNameError
Browse files Browse the repository at this point in the history
fix: sign up error in first anme []
  • Loading branch information
Astitva877 authored Jan 16, 2025
2 parents 59d389b + 6a27623 commit 2eefc49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import * as yup from 'yup';
const emailRegex = /^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]+)$/;
const firstNameRegex = /^[A-Za-z\s]+$/;
const lastNameRegex = /^[A-Za-z\s]*$/;
const firstNameSpaceCheck = /^[^\s].*$/;


//----------------------------- Check Validation ---------------------//
export const checkValidation = async (validationSchema, val) => {
Expand All @@ -25,7 +27,11 @@ export const registrationSchema = yup.object().shape({
.email()
.matches(emailRegex, 'Please enter a valid Email ID')
.required('Please enter a valid Email ID'),
firstName: yup.string().trim().matches(firstNameRegex, "Your first name cannot have numbers or special characters.").required('Please enter your first name.'),
firstName:yup
.string()
.matches(firstNameRegex, "Your first name cannot have numbers or special characters.")
.matches(firstNameSpaceCheck , 'Your first name cannot start with spaces.')
.required('Please enter your first name.'),
lastName: yup.string().matches(lastNameRegex, "Your last name cannot have numbers or special characters."),
password: yup
.string()
Expand Down

0 comments on commit 2eefc49

Please sign in to comment.