@Override @Transactional(timeout = 60) public VerificationToken registrateNewToken(VerificationToken verificationToken) { if (verificationToken.getType() == VerificationTokenPK.Type.PASSWORD_RESET && !userService.findByEmail(verificationToken.getEmail()).isPresent()) { throw new NotFoundException( String.format("The user with email %s was not found.", verificationToken.getEmail())); } generateToken(verificationToken); verificationTokenDao.save(verificationToken); emailService.sentVerificationToken( verificationToken.getEmail(), verificationToken.getType(), verificationToken.getToken()); return verificationToken; }
@Override @Transactional public VerificationToken save(VerificationToken verificationToken) { return verificationTokenDao.save(verificationToken); }