Skip to content

Commit

Permalink
Merge pull request #49 from Muxammadyor/muxammadyor/updated-UserValid…
Browse files Browse the repository at this point in the history
…ation

updated UserValidation
  • Loading branch information
ravshanbeek authored May 23, 2023
2 parents d4de355 + 73d4714 commit 92e0a8b
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,18 @@ public RegisterUserValidator()
RuleFor(user => user.Password)
.NotNull().NotEmpty().WithMessage("Password is required")
.Length(8, 50).WithMessage("Password must be between 8 and 50 characters");
//.Matches("[A-Z]").WithMessage("Password must contain at least one uppercase letter.")
//.Matches("[a-z]").WithMessage("Password must contain at least one lowercase letter.")
//.Matches("[0-9]").WithMessage("Password must contain at least one digit.")
//.Matches("[^a-zA-Z0-9]").WithMessage("Password must contain at least one non-alphanumeric character.");


RuleFor(user => user.PhoneNumber)
.NotNull().NotEmpty().WithMessage("Number is required");

RuleFor(user => user.FirstName)
.NotEmpty().WithMessage("First name is required.")
.Length(2, 50).WithMessage("First name must be between 2 and 50 characters.")
.Matches("^[a-zA-Z]+$").WithMessage("First name can only contain letters.");
.Length(2, 50).WithMessage("First name must be between 2 and 50 characters.");

RuleFor(user => user.LastName)
.NotEmpty().WithMessage("First name is required.")
.Length(2, 50).WithMessage("First name must be between 2 and 50 characters.")
.Matches("^[a-zA-Z]+$").WithMessage("First name can only contain letters.");
.Length(2, 50).WithMessage("First name must be between 2 and 50 characters.");
}
}
}

0 comments on commit 92e0a8b

Please sign in to comment.