Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public enum ErrorStatus implements BaseErrorCode {
_MEMBER_REGION_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER4010", "해당하는 회원의 관심 지역을 찾을 수 없습니다."),
_MEMBER_STUDY_REASON_NOT_FOUND(HttpStatus.NOT_FOUND, "MEMBER4011", "해당하는 회원의 스터디 이유를 찾을 수 없습니다."),
_MEMBER_PASSWORD_NOT_MATCH(HttpStatus.BAD_REQUEST, "MEMBER4012", "비밀번호가 일치하지 않습니다."),
_MEMBER_NOT_VERIFIED(HttpStatus.UNAUTHORIZED, "MEMBER4013", "전화번호 인증에 실패하였습니다."),
_MEMBER_NOT_VERIFIED(HttpStatus.UNAUTHORIZED, "MEMBER4013", "이메일 인증에 실패하였습니다."),
_MEMBER_PHONE_ALREADY_EXISTS(HttpStatus.BAD_REQUEST, "MEMBER4014", "해당 전화번호로 가입된 회원이 이미 존재합니다."),
_MEMBER_PW_AND_PW_CHECK_DO_NOT_MATCH(HttpStatus.BAD_REQUEST, "MEMBER4015", "비밀번호와 비밀번호 확인이 일치하지 않습니다."),
_MEMBER_EMAIL_NOT_VERIFIED(HttpStatus.UNAUTHORIZED, "MEMBER4016", "인증되지 않은 이메일입니다."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public class VerificationCode {
public VerificationCode(String email, String code, LocalDateTime expiredAt) {
this.email = email;
this.code = code;
this.expiredAt = expiredAt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*;

Expand All @@ -25,8 +24,15 @@ public class VerificationCodeRepositoryImpl implements VerificationCodeRepositor
public void addVerificationCode(String email, String code) {
if (email != null && code != null) {

// 만료기간이 지난 VerificationCode 삭제
verificationCodes.removeIf(verificationCode -> verificationCode.getExpiredAt().isBefore(LocalDateTime.now()));
verificationCodes.removeIf(verificationCode -> {
if (verificationCode.getExpiredAt() != null) {
// 만료기간이 지난 VerificationCode 삭제
return verificationCode.getExpiredAt().isBefore(LocalDateTime.now());
} else {
// 만료기간이 null 이면 바로 삭제
return true;
}
});

// 동일한 임시 토큰으로 생성한 코드가 이미 존재하는지 확인
VerificationCode existingCode = verificationCodes.stream()
Expand Down
Loading