Skip to content

feat: #260 이메일 주소 변경#274

Merged
FLYLIKEB merged 3 commits into
mainfrom
feature/issue-260-change-email
Mar 16, 2026
Merged

feat: #260 이메일 주소 변경#274
FLYLIKEB merged 3 commits into
mainfrom
feature/issue-260-change-email

Conversation

@FLYLIKEB
Copy link
Copy Markdown
Owner

@FLYLIKEB FLYLIKEB commented Mar 16, 2026

Summary

  • Closes [Feature] 이메일 주소 변경 #260
  • POST /api/auth/change-email/request — 새 이메일로 인증 메일 발송
  • POST /api/auth/change-email/confirm — 토큰 확인 후 이메일 변경
  • 이메일 중복 체크, 이메일 계정만 해당
  • Settings 페이지에서 이메일 변경 UI

Test plan

  • npm run build
  • npm run test:run
  • cd backend && npm run build && npm run test

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 사용자 설정에서 계정 이메일 변경 기능 추가
    • 새로운 이메일 입력 후 확인 토큰으로 변경을 승인하는 2단계 프로세스 지원
    • 설정 페이지에서 이메일 연결 계정 관리 옵션 제공
  • 테스트

    • 이메일 변경 요청 및 확인 플로우에 대한 엔드투엔드 테스트 추가

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cha-log Ready Ready Preview, Comment Mar 16, 2026 9:29am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 16, 2026

Warning

Rate limit exceeded

@FLYLIKEB has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 14444b4f-cda7-421e-a1f0-a60e5b4e11ae

📥 Commits

Reviewing files that changed from the base of the PR and between db5e5f1 and daf4191.

📒 Files selected for processing (5)
  • .claude/rules/testing.md
  • backend/src/auth/auth.controller.ts
  • backend/src/auth/auth.service.ts
  • backend/src/auth/dto/change-email.dto.ts
  • backend/src/auth/dto/verify-email.dto.ts

Walkthrough

이메일 주소 변경 기능을 구현합니다. 사용자가 새 이메일을 요청하면 인증 토큰을 발송하고, 토큰 확인으로 이메일을 업데이트합니다. 백엔드 엔드포인트, 서비스 로직, 데이터베이스 엔티티, 프론트엔드 UI와 API 클라이언트를 추가합니다.

Changes

Cohort / File(s) Summary
데이터베이스 마이그레이션 및 엔티티
backend/migrations/1813000000000-AddEmailChangeToken.ts, backend/src/auth/entities/email-change-token.entity.ts
email_change_tokens 테이블을 생성하고 TypeORM 엔티티로 정의합니다. userId 외래키(CASCADE 삭제), tokenHash(고유), newEmail, expiresAt, usedAt 칼럼을 포함합니다.
백엔드 서비스 및 컨트롤러
backend/src/auth/auth.service.ts, backend/src/auth/auth.controller.ts, backend/src/auth/auth.module.ts
requestEmailChange/confirmEmailChange 메서드를 서비스에 추가하고 해당 엔드포인트를 컨트롤러에 구현합니다. 토큰 생성, 유효성 검증, 이메일 업데이트 로직을 포함합니다.
DTO 및 메일 서비스
backend/src/auth/dto/change-email.dto.ts, backend/src/mail/mail.service.ts
ChangeEmailRequestDto와 ChangeEmailConfirmDto를 정의하고, sendEmailChangeEmail 메서드를 추가하여 인증 이메일을 발송합니다.
테스트 설정 및 E2E 테스트
backend/test/setup/test-setup.ts, backend/test/app.e2e-spec.ts, backend/test/suites/auth-change-email.e2e-spec.ts
이메일 변경 토큰의 데이터베이스 정리를 추가하고, 225줄의 포괄적인 E2E 테스트 스위트를 작성합니다. 인증, 중복 체크, 토큰 검증, OAuth 계정 제외 등을 검증합니다.
프론트엔드 API 및 UI
src/lib/api/auth.api.ts, src/pages/Settings.tsx, src/pages/__tests__/Settings.test.tsx
authApi에 requestEmailChange와 confirmEmailChange 메서드를 추가합니다. Settings 페이지에 이메일 변경 다이얼로그 UI를 구현하고, URL 토큰 처리를 통한 자동 확인 플로우를 추가합니다.

Sequence Diagram(s)

sequenceDiagram
    participant User as 사용자
    participant Frontend as 프론트엔드
    participant AuthCtrl as AuthController
    participant AuthSvc as AuthService
    participant MailSvc as MailService
    participant DB as Database

    User->>Frontend: 새 이메일 입력 & 변경 요청
    Frontend->>AuthCtrl: POST /auth/change-email/request
    AuthCtrl->>AuthSvc: requestEmailChange(userId, newEmail)
    AuthSvc->>DB: 기존 이메일 인증 확인
    AuthSvc->>DB: 새 이메일 중복 체크
    AuthSvc->>DB: 이전 토큰 무효화
    AuthSvc->>DB: 새 토큰 생성 (30분 만료)
    AuthSvc->>MailSvc: sendEmailChangeEmail(newEmail, token)
    MailSvc->>User: 인증 이메일 발송
    MailSvc-->>AuthSvc: 완료
    AuthSvc-->>AuthCtrl: { message: "..." }
    AuthCtrl-->>Frontend: 200 OK
    Frontend->>User: 성공 메시지 표시
Loading
sequenceDiagram
    participant User as 사용자
    participant Frontend as 프론트엔드
    participant AuthCtrl as AuthController
    participant AuthSvc as AuthService
    participant DB as Database

    User->>Frontend: 이메일의 확인 링크 클릭<br/>(토큰 포함)
    Frontend->>AuthCtrl: POST /auth/change-email/confirm
    AuthCtrl->>AuthSvc: confirmEmailChange(userId, token)
    AuthSvc->>DB: 토큰 검증<br/>(존재, 미사용, 미만료)
    AuthSvc->>DB: 새 이메일 중복 체크
    AuthSvc->>DB: user_authentications의<br/>providerId 업데이트
    AuthSvc->>DB: 토큰을 사용됨(usedAt)으로 표시
    AuthSvc-->>AuthCtrl: { message: "..." }
    AuthCtrl-->>Frontend: 200 OK
    Frontend->>User: 변경 완료 토스트 표시
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • feat: #217 비밀번호 찾기/재설정 기능 구현 #222: 이전 PR에서 도입한 MailService와 토큰 워크플로우를 확장합니다. EmailChangeToken 엔티티, 마이그레이션, 서비스 메서드 및 sendEmailChangeEmail 메서드를 동일한 MailService 클래스에 추가합니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목 'feat: #260 이메일 주소 변경'은 변경사항의 주요 기능을 명확하게 설명하며 연결된 이슈 #260과 일치합니다.
Linked Issues check ✅ Passed PR의 모든 코딩 요구사항이 충족되었습니다. 백엔드 엔드포인트 2개, 이메일 중복 체크, user_authentications 테이블 업데이트, 이메일 전용 계정 제한, 프론트엔드 UI, 토큰 확인 흐름이 모두 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 이슈 #260의 요구사항 범위 내에 있습니다. 추가로 구현된 요소들(마이그레이션, 엔티티, DTO, 테스트)은 모두 이메일 변경 기능을 지원하는 필수 구성 요소입니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/issue-260-change-email
📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@FLYLIKEB FLYLIKEB merged commit b5a7215 into main Mar 16, 2026
1 of 2 checks passed
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.

[Feature] 이메일 주소 변경

1 participant