private boolean validateNewPassword(RequestAndResponse requestAndResponse,final User editedUser,final boolean currentIsEditedUser,final String newPassword,final String newPassword2) throws IOException {
  boolean hasErrors=false;
  if (newPassword == null || newPassword.isEmpty()) {
    addErrorMessage(requestAndResponse,servletText.errorFirstPasswordMustBeSet(currentIsEditedUser,editedUser.getUserName()));
    hasErrors=true;
  }
  if (newPassword2 == null || newPassword2.isEmpty()) {
    addErrorMessage(requestAndResponse,servletText.errorSecondPasswordMustBeSet(currentIsEditedUser,editedUser.getUserName()));
    hasErrors=true;
  }
  if (!hasErrors && newPassword != null && newPassword2 != null && !newPassword2.equals(newPassword)) {
    addErrorMessage(requestAndResponse,servletText.errorPasswordsMustMatch());
    hasErrors=true;
  }
  if (!hasErrors && !AccountAttributeValidator.isPasswordValid(newPassword)) {
    addErrorMessage(requestAndResponse,servletText.errorPasswordIsNotValid());
    hasErrors=true;
  }
  return hasErrors;
}

private boolean validateNewPassword ( RequestAndResponse requestAndResponse , final User editedUser , final boolean currentIsEditedUser , final String newPassword , final String newPassword2 ) throws IOException { boolean hasErrors = false ; if ( newPassword == null || newPassword . isEmpty ( ) ) { addErrorMessage ( requestAndResponse , servletText . errorFirstPasswordMustBeSet ( currentIsEditedUser , editedUser . getUserName ( ) ) ) ; hasErrors = true ; } if ( newPassword2 == null || newPassword2 . isEmpty ( ) ) { addErrorMessage ( requestAndResponse , servletText . errorSecondPasswordMustBeSet ( currentIsEditedUser , editedUser . getUserName ( ) ) ) ; hasErrors = true ; } if ( ! hasErrors && newPassword != null && newPassword2 != null && ! newPassword2 . equals ( newPassword ) ) { addErrorMessage ( requestAndResponse , servletText . errorPasswordsMustMatch ( ) ) ; hasErrors = true ; } if ( ! hasErrors && ! AccountAttributeValidator . isPasswordValid ( newPassword ) ) { addErrorMessage ( requestAndResponse , servletText . errorPasswordIsNotValid ( ) ) ; hasErrors = true ; } return hasErrors ; }
validates the new password fields .
