code: boolean validatePasswords(String password1, String password2) {
  
          if (!password1.equals(password2)) {
              showPasswordMatchError(true);
              return false;
          }
          showPasswordMatchError(false);
          try {
              OpenCms.getPasswordHandler().validatePassword(password1);
              m_form.getPassword1Field().setComponentError(null);
              return true;
          } catch (CmsException e) {
              m_form.setErrorPassword1(new UserError(e.getLocalizedMessage(m_locale)), OpenCmsTheme.SECURITY_INVALID);
              return false;
          }
      }
docs: Validates the passwords, checking if they match and fulfill the requirements of the password handler.<p>
  Will show the appropriate errors if necessary.<p>
  
  @param password1 password 1
  @param password2 password 2
  
  @return <code>true</code> if valid