Example #1
0
 private void validatePass(final UserBean user)
     throws RegistrationBusinessException, RegistrationException {
   final Pattern pattern;
   final Matcher matcher;
   final String password = user.getPass();
   final String conPassword = user.getConPass();
   final String passPattern = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})";
   pattern = Pattern.compile(passPattern);
   matcher = pattern.matcher(password);
   if (password.isEmpty()) {
     throw new RegistrationBusinessException("Please enter a password!!!!");
   } else if (!matcher.matches()) {
     throw new RegistrationBusinessException("Invalid Password!!!!");
   } else if (!password.equals(conPassword)) {
     throw new RegistrationBusinessException("Passwords does not match!!!!");
   }
 }
Example #2
0
 public boolean regUser(UserBean user)
     throws RegistrationBusinessException, RegistrationException {
   boolean flag = true;
   validateName(user.getName());
   validatePass(user);
   RegisterDAO regDAO = new RegisterDAO();
   flag = regDAO.insertUser(user);
   return flag;
 }