Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
reissue 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ori0o0p committed Jan 25, 2024
1 parent 7da61ca commit 7031a6c
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import reactor.core.scheduler.Schedulers;

import java.io.UnsupportedEncodingException;
import java.util.Objects;
import java.util.Random;

@Service
Expand Down Expand Up @@ -42,6 +43,17 @@ public Mono<Void> execute(AuthCodeRequest request) {
.then();
}

public Mono<Void> reissue(AuthCodeRequest request) {
return getAuthCode(request.mail())
.flatMap(authCode -> codeRepository.delete(authCode)
.then(execute(request)))
.switchIfEmpty(execute(request));
}

private Mono<AuthCode> getAuthCode(String mail) {
return codeRepository.findByMail(mail);
}

private Mono<MimeMessage> sendMail(String to, String authCode) {
return Mono.fromCallable(() -> {
try {
Expand Down

0 comments on commit 7031a6c

Please sign in to comment.