first commit

This commit is contained in:
2023-08-12 23:32:39 +08:00
parent 75e852d060
commit 12c94732bc
2 changed files with 5 additions and 0 deletions

View File

@@ -30,6 +30,10 @@ public class CodeServ {
return code.getCode();
}
public void deleteCode(String email) {
codeRepo.deleteById(email);
}
private void lazyDeleteCode() {
LocalDateTime now = LocalDateTime.now();
if (lazyCleanTime.isBefore(now.minusSeconds(Constant.VALID_CODE_EXPIRE_SECONDS))) {

View File

@@ -70,6 +70,7 @@ public class UserServ {
if (!Objects.equals(code, codeServ.getCode(email))) {
throw new RuntimeException();
}
codeServ.deleteCode(email);
}
private void validEmail(String email) {