-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow list and Activation code updates
- Loading branch information
Showing
10 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package it.chalmers.gamma; | ||
|
||
import it.chalmers.gamma.app.user.activation.domain.UserActivationRepository; | ||
import it.chalmers.gamma.app.user.passwordreset.domain.PasswordResetRepository; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
@Component | ||
public class ScheduledTasks { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(ScheduledTasks.class); | ||
|
||
private final UserActivationRepository userActivationRepository; | ||
private final PasswordResetRepository passwordResetRepository; | ||
|
||
public ScheduledTasks(UserActivationRepository userActivationRepository, PasswordResetRepository passwordResetRepository) { | ||
this.userActivationRepository = userActivationRepository; | ||
this.passwordResetRepository = passwordResetRepository; | ||
} | ||
|
||
@Scheduled(timeUnit = TimeUnit.MINUTES, fixedRate = 15) | ||
public void clearInvalidActivationCodes() { | ||
int i = userActivationRepository.removeInvalidActivationCodes(); | ||
if (i > 0) { | ||
LOGGER.info("Removed {} expired user activation codes", i); | ||
} | ||
} | ||
|
||
@Scheduled(timeUnit = TimeUnit.MINUTES, fixedRate = 15) | ||
public void clearInvalidPasswordResetTokens() { | ||
int i = passwordResetRepository.removeInvalidPasswordResetTokens(); | ||
if (i > 0) { | ||
LOGGER.info("Removed {} expired password reset tokens", i); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters