public ReturnStatus askpassword(String email, String userName) {

    System.out.println("askpassword");

    User usr = null;

    String qry = "select u from User u where u.userName = '******'";
    System.out.println("Query = " + qry);

    // Valideer correctheid email
    try {
      javax.mail.internet.InternetAddress ia = new javax.mail.internet.InternetAddress(email);
      ia.validate();
    } catch (javax.mail.internet.AddressException e) {
      return new ReturnStatus(false, "email is niet juist formaat (server controlled).");
    }

    List<User> users =
        em.createQuery(qry, User.class).setFirstResult(0).setMaxResults(1).getResultList();

    System.out.println("Query uitgevoerd");

    if (users != null) {
      System.out.println("Er lijkt resultaat");
      if (!users.isEmpty()) {
        System.out.println("Proberen te lezen");
        usr = users.get(0);
        System.out.println("User gevonden : " + usr.getUserName());
        if (usr.getEmail().equalsIgnoreCase(email)) {
          System.out.println("email ok");
          String message = "Uw password voor username " + userName + " is : " + usr.getPassword();
          boolean result = emailBean.sendEmailSSL(email, "password aanvraag", message);
          if (result) {
            return new ReturnStatus(true, "Mail verzonden");
          } else {
            return new ReturnStatus(true, "Mail niet verzonden");
          }
        } else {
          System.out.println("email is niet hetzelfde : " + usr.getEmail() + " en " + email);
          return new ReturnStatus(
              false, "email is niet hetzelfde : " + usr.getEmail() + " en " + email);
        }
      } else {
        System.out.println("Toch geen resultaat");
        return new ReturnStatus(false, "gebruiker is niet bekend");
      }
    } else {
      System.out.println("User niet gevonden");
      return new ReturnStatus(false, "gebruiker is niet bekend");
    }
  }
  public ReturnStatus register(String email, String userName, String password) {

    System.out.println("register");

    if (checkUser(userName)) {
      return new ReturnStatus(false, "Gebruiker bestaat al. Kies een andere naam.");
    }

    // Valideer correctheid email
    try {
      javax.mail.internet.InternetAddress ia = new javax.mail.internet.InternetAddress(email);
      ia.validate();
    } catch (javax.mail.internet.AddressException e) {
      return new ReturnStatus(false, "email is niet juist formaat (server controlled).");
    }

    User user = new User();
    user.setEmail(email);
    user.setUserName(userName);
    user.setPassword(password);
    System.out.println("create : " + userName);

    em.persist(user);

    String subject = "Accountaanvraag";
    String message =
        "Uw aanvraag voor gebruikersnaam "
            + userName
            + " en wachtwoord "
            + password
            + " is verwerkt.";

    boolean result = emailBean.sendEmailSSL(email, subject, message);

    // boolean result = emailBean.sendEmailTLS(email, subject,  message);
    // boolean result = emailBean.sendEmailSSL_HTML(email, subject,  message);

    if (result) {
      return new ReturnStatus(true, "Mail verzonden");
    } else {
      return new ReturnStatus(true, "Mail niet verzonden");
    }
  }