Skip to content
Snippets Groups Projects
Commit 3a60c816 authored by Matija Obreza's avatar Matija Obreza
Browse files

New verification tokens live for 48 hours

parent 378cd077
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,9 @@
package org.genesys2.server.service.impl;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
......@@ -24,21 +27,17 @@ import org.genesys2.server.persistence.domain.VerificationTokenRepository;
import org.genesys2.server.service.JPATokenStoreCleanup;
import org.genesys2.server.service.TokenVerificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Calendar;
import java.util.Date;
@Service
@Transactional(readOnly = true)
public class TokenVerificationServiceImpl implements TokenVerificationService, JPATokenStoreCleanup {
private static final Log LOG = LogFactory.getLog(TokenVerificationServiceImpl.class);
private static final int HOURS_UNTIL_INVALID = 4;
private static final int HOURS_UNTIL_INVALID = 48;
@Autowired
private VerificationTokenRepository verificationTokenRepository;
......@@ -61,8 +60,8 @@ public class TokenVerificationServiceImpl implements TokenVerificationService, J
return token;
}
@Override
@Transactional
@Override
@Transactional
public void cancel(String tokenUuid) throws NoSuchVerificationTokenException {
final VerificationToken verificationToken = verificationTokenRepository.findByUuid(tokenUuid);
if (verificationToken == null) {
......@@ -99,7 +98,6 @@ public class TokenVerificationServiceImpl implements TokenVerificationService, J
return verificationToken;
}
/**
* Cleanup executed every 10 minutes
*/
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment