Skip to content

Commit

Permalink
Revert "avniproject/avni-security#42 | Maha/Suhas | Add validation fo…
Browse files Browse the repository at this point in the history
…r User.name during create and edit"

This reverts commit 639ff3f.
  • Loading branch information
mahalakshme committed Sep 15, 2023
1 parent 2f9218b commit bf927c3
Showing 1 changed file with 0 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public class UserController {

@Value("${avni.userPhoneNumberPattern}")
private String MOBILE_NUMBER_PATTERN;

private final String NAME_PATTERN = "[a-zA-Z0-9 ]+";
private final AccessControlService accessControlService;

@Autowired
Expand Down Expand Up @@ -164,9 +162,6 @@ private Boolean phoneNumberIsValid(String phoneNumber) {
return phoneNumber.matches(MOBILE_NUMBER_PATTERN);
}

private boolean nameIsValid(String name) {
return name.matches(NAME_PATTERN);
}
private User setUserAttributes(User user, UserContract userContract) {
if (!emailIsValid(userContract.getEmail()))
throw new ValidationException(String.format("Invalid email address %s", userContract.getEmail()));
Expand All @@ -176,11 +171,7 @@ private User setUserAttributes(User user, UserContract userContract) {
throw new ValidationException(String.format("Invalid phone number %s", userContract.getPhoneNumber()));
user.setPhoneNumber(userContract.getPhoneNumber());


if (!nameIsValid(userContract.getPhoneNumber()))
throw new ValidationException(String.format("Invalid name %s", userContract.getName()));
user.setName(userContract.getName());

if(userContract.getCatchmentId()!=null) {
user.setCatchment(catchmentRepository.findOne(userContract.getCatchmentId()));
}
Expand Down

0 comments on commit bf927c3

Please sign in to comment.