Skip to content

fix(auth): 탈퇴 회원 카카오 재가입 허용 - #102

Merged
evenif99 merged 2 commits into
devfrom
fix/allow-reactivation-after-withdrawal
Jun 22, 2026
Merged

fix(auth): 탈퇴 회원 카카오 재가입 허용#102
evenif99 merged 2 commits into
devfrom
fix/allow-reactivation-after-withdrawal

Conversation

@evenif99

@evenif99 evenif99 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 탈퇴한 회원이 동일 카카오 계정으로 재가입(로그인) 가능하도록 수정
  • signIn 콜백에서 deletedAt 존재 시 계정 복구 처리 (기존: 로그인 차단)
  • deletedAt, deletionRequestedAt 초기화 + kakaoId 재연결
  • auditLogUSER_REACTIVATED 이벤트 기록

주의사항

  • audit_logs 테이블 및 audit_event_type enum에 USER_REACTIVATED 값이 DB에 반영되어야 정상 동작합니다
  • DB 담당자(이승규)에게 migration 요청 완료

Test plan

  • 회원 탈퇴 후 동일 카카오 계정으로 로그인 시 정상 재가입 확인
  • 재가입 후 deletedAt, deletionRequestedAt이 null인지 확인
  • audit_logsUSER_REACTIVATED 이벤트 기록 확인
  • 기존 정상 회원 로그인에 영향 없는지 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능
    • 삭제된 계정으로 로그인하면 계정이 자동으로 재활성화된 뒤 로그인이 허용됩니다. 사용자는 재가입 없이 기존 계정을 복구할 수 있습니다.
    • 재활성화 과정에서 계정 연동 정보가 현재 로그인 정보에 맞게 업데이트됩니다.
  • 기타
    • 계정 재활성화가 감사 로그에 기록됩니다.

- signIn 콜백에서 deletedAt 존재 시 계정 복구 처리
- deletedAt, deletionRequestedAt null 초기화
- kakaoId 재연결
- auditLog에 USER_REACTIVATED 이벤트 기록

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
talky-owl Ready Ready Preview, Comment Jun 22, 2026 5:28am

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 25be8eda-4928-4a6f-97f2-3777a030c9dd

📥 Commits

Reviewing files that changed from the base of the PR and between 5800ea4 and 2bbd970.

📒 Files selected for processing (1)
  • prisma/schema.prisma

📝 Walkthrough

Walkthrough

authOptions.callbacks.signIn에서 existing?.deletedAt가 참일 때 즉시 false를 반환해 로그인을 차단하던 로직이 제거됐습니다. 대신 prisma.$transaction을 통해 deletedAt·deletionRequestedAt 복구, kakaoId 갱신, USER_REACTIVATED 감사 로그 생성 후 true를 반환하는 재활성화 흐름으로 변경됐습니다. 감사 로그 스키마에 USER_REACTIVATED 이벤트 타입이 추가됐습니다.

Changes

계정 재활성화 트랜잭션

Layer / File(s) Summary
signIn 콜백 재활성화 트랜잭션
prisma/schema.prisma, src/lib/auth/index.ts
AuditEventTypeUSER_REACTIVATED 이벤트 타입을 추가하고, existing.deletedAt 분기에서 return false 대신 prisma.$transaction으로 deletedAt·deletionRequestedAtnull로 복구하며 kakaoId를 현재 카카오 계정의 providerAccountId로 갱신하고, USER_REACTIVATED 감사 로그를 생성한 뒤 return true로 로그인을 허용한다.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • I5-Project/TALKY-OWL#59: 동일하게 src/lib/auth/index.tscallbacks.signIn에서 카카오 식별자 조회 및 사용자 라이프사이클 분기 로직을 수정하며, 이번 PR의 kakaoId 갱신 흐름과 맞닿는다.
  • I5-Project/TALKY-OWL#94: 사용자 삭제 시 kakaoIdnull로 초기화하는 로직을 포함해, 이번 PR의 재활성화 시 kakaoId 재설정 흐름과 동일 도메인(탈퇴 후 카카오 재로그인)에서 직접 연결된다.

Poem

🐰 삭제된 올빼미도 다시 돌아왔네,
deletedAt은 null, 문이 다시 열리고,
카카오 ID도 새로 새겨지며,
감사 로그엔 USER_REACTIVATED 새겨졌지.
트랜잭션 완료, true를 반환해~
토끼가 코드를 고치니 올빼미가 웃네! 🦉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive PR 설명이 변경사항, 주의사항, 테스트 계획을 포함하고 있으나, 제공된 템플릿의 필수 섹션 대부분이 채워지지 않았습니다. 핵심 정보는 있으나 템플릿 준수 부족입니다. PR 템플릿의 작업 영역, 관련 Issue, 변경 사항, 테스트 결과 체크박스, 작업 범위 확인, 보안 확인 등의 필수 섹션을 채워주시기 바랍니다.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경사항을 명확하게 요약하고 있습니다. 탈퇴 회원의 카카오 재가입 허용이라는 핵심 기능 변경을 간결하고 구체적으로 표현했습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/allow-reactivation-after-withdrawal

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/lib/auth/index.ts`:
- Around line 131-148: The auditLog.create call in the transaction is using the
event type USER_REACTIVATED which is not defined in the AuditEventType enum in
the Prisma schema. Add the USER_REACTIVATED value to the AuditEventType enum
definition in prisma/schema.prisma, then create and apply a migration for this
schema change, and finally regenerate the Prisma client using prisma generate to
ensure the changes are reflected in the generated types and client.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 19d81582-038f-445a-b13b-354173f0e791

📥 Commits

Reviewing files that changed from the base of the PR and between 35e3b81 and 5800ea4.

📒 Files selected for processing (1)
  • src/lib/auth/index.ts

Comment thread src/lib/auth/index.ts
@evenif99 evenif99 self-assigned this Jun 22, 2026
- Vercel 빌드 타입 에러 해결

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@evenif99
evenif99 merged commit b5d4395 into dev Jun 22, 2026
3 checks passed
@evenif99
evenif99 deleted the fix/allow-reactivation-after-withdrawal branch June 22, 2026 06:15
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.

1 participant