Skip to content

fix(auth): 비회원 보호 페이지 접근 시 로그인 리다이렉트 적용 - #109

Merged
evenif99 merged 1 commit into
devfrom
fix/auth-guard-protected-pages
Jun 22, 2026
Merged

fix(auth): 비회원 보호 페이지 접근 시 로그인 리다이렉트 적용#109
evenif99 merged 1 commit into
devfrom
fix/auth-guard-protected-pages

Conversation

@evenif99

@evenif99 evenif99 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 미들웨어의 DEV_BYPASS 제거 및 next-auth 기본 미들웨어로 교체
  • 비회원이 감정일기, 마이페이지 등 보호 페이지 접근 시 /login으로 리다이렉트
  • 홈(/), about, contact, join 등 공개 페이지는 matcher에서 제외하여 비회원 접근 유지

변경 내용

  • DEV_BYPASS 로직 제거 → export { default } from 'next-auth/middleware'로 단순화
  • matcher에 공개 페이지 추가: about, contact, join, 루트($)
  • 보호 대상: diary, mypage, records, calendar, disputes, rooms 등

Test plan

  • 비회원 상태에서 하단 탭 '일기' 클릭 → 로그인 화면 이동 확인
  • 비회원 상태에서 하단 탭 '마이페이지' 클릭 → 로그인 화면 이동 확인
  • 비회원 상태에서 홈(/) 접근 → 정상 표시 확인
  • 비회원 상태에서 /about, /terms, /privacy 접근 → 정상 표시 확인
  • 로그인 후 diary, mypage 정상 접근 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Refactor
    • 인증 미들웨어 설정이 간소화되었습니다.
    • 특정 페이지의 인증 처리 범위가 조정되었습니다.

DEV_BYPASS를 제거하고 next-auth 기본 미들웨어로 교체하여
비회원이 보호 페이지(감정일기, 마이페이지 등) 접근 시
로그인 화면으로 리다이렉트되도록 수정.

홈(/), about, contact, join 등 공개 페이지는 matcher에서
제외하여 비회원도 접근 가능하도록 유지.

Co-Authored-By: Claude <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 9:21am

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro Plus

Run ID: 942e641e-0af3-447d-a177-06150c955b6e

📥 Commits

Reviewing files that changed from the base of the PR and between 19916c2 and 2ebfe57.

📒 Files selected for processing (1)
  • src/middleware.ts

📝 Walkthrough

Walkthrough

src/middleware.ts에서 withAuth 기반 커스텀 미들웨어와 DEV_BYPASS 인증 우회 로직을 제거하고, next-auth/middleware의 기본 export를 직접 재export하도록 변경했습니다. config.matcher의 제외 경로 정규식도 수정되어 about, contact, join 등의 경로가 추가되었습니다.

Changes

미들웨어 단순화

Layer / File(s) Summary
기본 export 및 matcher 경로 변경
src/middleware.ts
withAuth 래퍼와 DEV_BYPASS 분기 로직을 제거하고 next-auth/middleware를 직접 재export하도록 변경합니다. config.matcher 정규식에서 제외 경로(about, contact, join 등)를 추가합니다.

예상 코드 리뷰 노력

🎯 2 (Simple) | ⏱️ ~5 minutes

관련 가능성이 있는 PR

  • I5-Project/TALKY-OWL#58: 동일한 src/middleware.tsconfig.matcher 제외 경로를 수정한 PR로, /terms/privacy 경로를 추가하는 변경이 포함되어 있어 직접적으로 연관됩니다.

Poem

🐰 토끼가 코드를 훑어보니,
복잡한 withAuth 사라지고,
next-auth가 쏙 들어왔네.
about, contact 길을 열어두고,
미들웨어가 날아갈 듯 가볍구나~ 🦉✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/auth-guard-protected-pages

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

@evenif99 evenif99 self-assigned this Jun 22, 2026
@evenif99
evenif99 merged commit 72a7d57 into dev Jun 22, 2026
2 of 3 checks passed
@evenif99
evenif99 deleted the fix/auth-guard-protected-pages branch June 22, 2026 09:25
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