Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Jun 23, 2025

작업 내용

  • 이메일 인증 방식 개선: 인증 코드 입력 없이 이메일 버튼 클릭으로 인증 처리되도록 수정
  • CORS 설정 추가 (Spring Security 내 전역 허용)
  • 비밀번호 찾기 로직 작업 중 (미완성 상태) (cors 오류 해결을 위해 중간 PR)

변경 사항

  • 인증 코드 입력 없이 이메일 내 링크 클릭 시 user.verified = true 처리
  • CorsConfigurationSource Bean 등록 및 http.cors() 활성화
    → 모든 Origin, Header, Method 허용 (setAllowedOrigins("*"))
  • AuthService.findPassword() 로직 작성 중 (기능 일부 구현됨)

트러블 슈팅

  1. 이메일 인증 시 사용자가 인증 코드를 복사/입력하는 UX가 불편함
    → 인증 메일에 포함된 링크 클릭 시 토큰을 자동 처리하도록 로직 변경

  2. 프론트엔드 요청 시 CORS 에러 발생
    → Spring Security에서 .cors(Customizer.withDefaults()) 추가 및 CorsConfigurationSource에서 전역 허용 설정


해결해야 할 문제

  • localhost -> 실제 경로로 수정
  • 비밀번호 찾기 기능

참고 사항

  • 우선 테스트용으로 이메일 인증시 localhost로 돌아가게 해두었습니다

코드 리뷰 전 확인 체크리스트

  • 불필요한 콘솔 로그, 주석 제거
  • 커밋 메시지 컨벤션 준수 (type : )
  • 기능 정상 동작 확인

Summary by CodeRabbit

  • 신규 기능
    • 이메일 인증 코드 발송 및 인증 기능이 추가되었습니다.
    • 비밀번호 찾기 및 비밀번호 재설정 코드 인증 기능이 도입되었습니다.
  • 버그 수정
    • 보안 강화를 위해 이메일 인증 및 비밀번호 재설정 절차가 개선되었습니다.
  • 기타
    • CORS 정책이 추가되어 다양한 도메인에서의 접근이 허용됩니다.

@minjee2758 minjee2758 self-assigned this Jun 23, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 23, 2025

Walkthrough

비밀번호 찾기 및 이메일 인증 기능을 위한 주요 확장 및 리팩토링이 이루어졌습니다. 새로운 요청/응답 DTO가 추가되고, AuthService와 MailService가 비밀번호 재설정 및 이메일 인증 흐름을 지원하도록 변경되었으며, CORS 설정도 보안 구성에 포함되었습니다. AuthController에 관련 엔드포인트가 신설되었습니다.

Changes

파일/경로 요약 변경 내용 요약
.../auth/dto/request/FindPasswordRequest.java
.../auth/dto/response/FindPasswordResponse.java
비밀번호 찾기 요청/응답 DTO 신설
.../auth/service/AuthService.java 이메일 인증 및 비밀번호 찾기 서비스 메서드 추가 및 기존 메서드 시그니처/로직 수정
.../usermanagement/auth/service/MailService.java Redis 기반 인증 코드 저장, 다양한 이메일 유형 지원, 코드 검증 로직 추가 및 기존 메서드 리팩토링
.../presentation/usermanagement/AuthController.java 이메일 인증, 비밀번호 찾기, 코드 검증용 신규 엔드포인트 추가
.../security/config/SecurityConfig.java CORS 설정 추가 및 관련 빈 등록

Sequence Diagram(s)

sequenceDiagram
    participant 사용자
    participant AuthController
    participant AuthService
    participant MailService
    participant Redis
    participant UserRepository

    사용자->>AuthController: POST /auth/find-password (email)
    AuthController->>AuthService: findPassword(request)
    AuthService->>UserRepository: 사용자(email) 조회
    UserRepository-->>AuthService: 사용자 정보 반환
    AuthService->>MailService: sendPasswordMail(userId, email)
    MailService->>Redis: 인증 코드 저장 (10분 만료)
    MailService->>사용자: 비밀번호 재설정 이메일 발송
    AuthService-->>AuthController: FindPasswordResponse 반환
    AuthController-->>사용자: 응답 반환

    사용자->>AuthController: GET /auth/verify-password-code?email&key
    AuthController->>AuthService: changePasswordByEmail(email, key)
    AuthService->>UserRepository: 사용자(email) 조회
    AuthService->>MailService: verifyCode(userId, key)
    MailService->>Redis: 코드 일치 여부 확인 및 삭제
    AuthService-->>AuthController: FindPasswordResponse 반환
    AuthController-->>사용자: 응답 반환
Loading

Possibly related PRs

Suggested labels

enhancement, documentation

Suggested reviewers

  • pokerbearkr
  • thezz9
  • NCookies

Poem

🐰
비밀번호를 잃어버려도 걱정 마세요,
토끼가 이메일로 코드를 보내드려요!
인증 버튼 꾹~ 누르면
안전하게 비밀번호 찾기 성공!
Redis 속에 숨겨둔 비밀 숫자,
오늘도 개발자는 안심하고 웃어요.
🍀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea0d16a and 85757fc.

📒 Files selected for processing (1)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/ezcode/codetest/application/usermanagement/auth/service/AuthService.java
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants