From 670853a71263a49643b825dbc63ac0f8d1ddeb75 Mon Sep 17 00:00:00 2001 From: Myungjun Jang Date: Sat, 11 Jul 2026 17:29:55 +0900 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20Auth=20?= =?UTF-8?q?=EB=8F=84=EB=A9=94=EC=9D=B8=20=EB=94=94=ED=85=8C=EC=9D=BC/?= =?UTF-8?q?=EC=9D=BC=EA=B4=80=EC=84=B1=20=EB=B3=B4=EC=99=84=20(#142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SmsSendResponse.expiredAt 주석 오류 정정 (3분 -> 5분) - 데드코드 generateSmsToken 제거 (호출처 없음, 인증 우회 소지) - resetPassword 트랜잭션 애노테이션 스프링으로 통일 - resetPassword에서 sms_required 플래그 삭제로 잠금 해제 일관성 확보 Co-Authored-By: Claude Opus 4.8 --- .../scoi/domain/auth/dto/AuthResDTO.java | 2 +- .../scoi/domain/auth/service/AuthService.java | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/example/scoi/domain/auth/dto/AuthResDTO.java b/src/main/java/com/example/scoi/domain/auth/dto/AuthResDTO.java index cbf8e2b..44afd07 100644 --- a/src/main/java/com/example/scoi/domain/auth/dto/AuthResDTO.java +++ b/src/main/java/com/example/scoi/domain/auth/dto/AuthResDTO.java @@ -9,7 +9,7 @@ public class AuthResDTO { // SMS 발송 응답 @JsonInclude(JsonInclude.Include.NON_NULL) public record SmsSendResponse( - LocalDateTime expiredAt, // 인증번호 만료 시간 (발송 시간 + 3분) + LocalDateTime expiredAt, // 인증번호 만료 시간 (발송 시간 + 5분) String verificationCode // 개발/QA 환경에서만 포함 (프로덕션에서는 null) ) {} diff --git a/src/main/java/com/example/scoi/domain/auth/service/AuthService.java b/src/main/java/com/example/scoi/domain/auth/service/AuthService.java index 2043ca0..c25381c 100644 --- a/src/main/java/com/example/scoi/domain/auth/service/AuthService.java +++ b/src/main/java/com/example/scoi/domain/auth/service/AuthService.java @@ -197,7 +197,7 @@ public String validateVerificationToken(String verificationToken, String phoneNu } // 간편 비밀번호 재설정 - @jakarta.transaction.Transactional + @Transactional public Void resetPassword( AuthReqDTO.ResetPassword dto ) { @@ -232,6 +232,9 @@ public Void resetPassword( // 로그인 횟수 -> 0 member.resetLoginFailCount(); + + // RT 만료로 걸린 SMS 재인증 플래그 해제 (이미 SMS 인증을 통과했으므로 잠금 완전 해제) + redisUtil.delete(SMS_REQUIRED_PREFIX + phoneNumber); return null; } @@ -482,18 +485,4 @@ public void logout(String phoneNumber, String accessToken) { log.info("로그아웃 성공: phoneNumber={}", phoneNumber); } - - // 임시 - public String generateSmsToken( - String phoneNumber - ) { - // 4. Verification Token 발급 - String verificationToken = jwtUtil.createVerificationToken(phoneNumber); - - // 5. Redis 저장 (10분 TTL) - String tokenKey = VERIFICATION_PREFIX + verificationToken; - redisUtil.set(tokenKey, phoneNumber, VERIFICATION_EXPIRATION_MINUTES, TimeUnit.MINUTES); - - return verificationToken; - } } \ No newline at end of file