Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
imenuuu committed Mar 17, 2024
2 parents 689f3a4 + 3d2e19d commit cd84837
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ public VerificationMessage sendCode(Long userId, UserRequest.SendCodeDTO request
// updatedAt과 현재 시간(now) 사이의 차이를 계산
Duration duration = Duration.between(updatedAt, now);

// 차이가 5분 이내인지 확인
if(verificationMessage.getRequestCount() >= 3 && duration.toMinutes() < 5) {
// 4, 7, 10, ...
boolean isWaitingCount = (verificationMessage.getRequestCount() % 3 == 0) && verificationMessage.getRequestCount() != 0;
// 차이가 5분 이내인지 확인
if(isWaitingCount && duration.toMinutes() < 5) {
// 에러 응답 로직
throw new UserException(CommonResponseStatus.REQUEST_RATE_LIMIT_EXCEEDED);
}
Expand Down Expand Up @@ -246,6 +248,7 @@ public VerificationMessage verifyCode(Long userId, UserRequest.VerifyCodeDTO req
// 3. 제공된 인증 번호가 검증 번호와 일치하는지 확인
if(verificationMessage.getVerificationNumber().equals(request.getVerificationCode())) {
verificationMessage.setStatus(VerifyMessageStatus.VERIFIED);
verificationMessage.setRequestCount(0);
verificationMessage.setVerifiedAt(LocalDateTime.now());
} else {
verificationMessage.setStatus(VerifyMessageStatus.FAILED);
Expand Down

0 comments on commit cd84837

Please sign in to comment.