/** * Associates an otp list with a user. * * @return associated otp list */ @Override public OneTimePasswordList associateOtpListWithUser(OneTimePasswordList passwordList, User user) throws OneTimePasswordListNotFreeException { validateListIsFree(passwordList); passwordList.setUser(user); passwordList.setStatus(statusDao.getByValue("associated")); passwordListDao.update(passwordList); return passwordList; }
/** * Generates a list of one time passwords. * * @return list of one time passwords */ @Override public OneTimePasswordList generatePasswordList(Date expiryDate) { OneTimePasswordList passwordList = new OneTimePasswordList(); passwordList.setPasswords(generatePasswords()); passwordList.setStatus(statusDao.getByValue("free")); passwordList.setSize(LIST_SIZE); passwordList.setExpires(expiryDate); passwordListDao.save(passwordList); return passwordList; }