@Override @Transactional(timeout = 60) public VerificationToken resentToken(VerificationToken verificationToken) { generateToken(verificationToken); if (verificationToken.getType() == VerificationTokenPK.Type.PASSWORD_RESET && verificationToken.isVerified()) { verificationToken.setVerified(false); } VerificationToken updated = verificationTokenDao.update(verificationToken); emailService.sentVerificationToken( updated.getEmail(), verificationToken.getType(), updated.getToken()); return verificationToken; }
@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 public void sendEmailRegistrationToken(VerificationToken verificationToken) { emailService.sentVerificationToken( verificationToken.getEmail(), verificationToken.getType(), verificationToken.getToken()); }