@Override public TokenAction create(final TokenAction.Type type, final User targetUser) { final TokenAction tokenAction = new TokenAction(); tokenAction.setTargetUser(targetUser); tokenAction.setToken(generateToken()); tokenAction.setType(type); final Date created = new Date(); tokenAction.setCreated(created); tokenAction.setExpires(new Date(created.getTime() + VERIFICATION_TIME * 1000)); tokenDao.save(tokenAction); return tokenAction; }
@Override public void deleteByUser(final User user, final TokenAction.Type type) { tokenDao.delete(tokenDao.findTokenByUserAndType(user, type)); }
@Override public void create(final TokenAction tokenAction) { tokenDao.save(tokenAction); }
@Override public TokenAction findByToken(final String token, final TokenAction.Type type) { return tokenDao.findByToken(token, type); }