protected String generatePasswordResetRecord(User u) { EntityManager em = JPA.em(JpaConstants.DB); String token = generateToken(); TokenActionHome tokenDao = new TokenActionHome(); tokenDao.create("PASSWORD_RESET", token, u, em); em.close(); return token; }
protected String generateVerificationRecord(User user) { EntityManager em = JPA.em(JpaConstants.DB); String token = generateToken(); // Do database actions, etc. TokenActionHome tokenDao = new TokenActionHome(); tokenDao.create("EMAIL_VERIFICATION", token, user, em); em.close(); return token; }