コード例 #1
0
 @Override
 @Transactional(readOnly = true)
 public VerificationToken getByEmail(String email, VerificationTokenPK.Type type) {
   VerificationToken verificationToken = verificationTokenDao.getByEmail(email, type);
   if (verificationToken == null) throw new NotFoundException();
   return verificationToken;
 }
コード例 #2
0
 @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;
 }
コード例 #3
0
  @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;
  }
コード例 #4
0
 @Override
 @Transactional(readOnly = true)
 public Optional<VerificationToken> getToken(VerificationToken token) {
   return verificationTokenDao.getToken(token);
 }
コード例 #5
0
 @Override
 @Transactional(readOnly = true)
 public boolean isPresent(VerificationToken verificationToken) {
   Optional<VerificationToken> token = verificationTokenDao.getToken(verificationToken);
   return token.isPresent();
 }
コード例 #6
0
 @Override
 @Transactional
 public VerificationToken update(VerificationToken verificationToken) {
   return verificationTokenDao.update(verificationToken);
 }
コード例 #7
0
 @Override
 @Transactional(readOnly = true)
 public Optional<VerificationToken> getByToken(String token) {
   return Optional.ofNullable(verificationTokenDao.getByToken(token));
 }