Skip to content

fix: 로그인 및 회원가입 뒤로가기 리디렉트 강화 등 오류 수정 - #76

Merged
9g-g9 merged 8 commits into
devfrom
fix/auth-login-fix
Aug 7, 2026
Merged

fix: 로그인 및 회원가입 뒤로가기 리디렉트 강화 등 오류 수정#76
9g-g9 merged 8 commits into
devfrom
fix/auth-login-fix

Conversation

@9g-g9

@9g-g9 9g-g9 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

📋 작업 내용

  • 로그인 및 회원가입 후 즉시 뒤로가기를 했을 때 해당 역할과 프로필 완료 여부를 확인하여 리디렉트 하도록 수정하였습니다.
  • 기사님 로그인 후 공개페이지인 /movers 에 접근하면 기사님 홈으로 리디렉트 하도록 수정하였습니다.
  • 비밀번호 숨기기, 보이기 버튼에 tab-index={-1} 을 추가하였습니다.

🔥 변경 사항

GuestOnly

  • 예약 경로(postAuthRedirectPath)가 없을 때 getPostAuthRedirectPath로 status 조회를 합니다.
  • 동작 형식 : 뒤로가기로 auth 페이지 접근 시 프로필 미완료 -> 프로필 생성, 완료·조회 실패 -> 역할 홈
  • 회원가입 직후 뒤로가기로 /signup에 다시 들어와도 가입 폼에 머물지 않고 프로필/홈으로 리디렉트 합니다.

기사님 찾기 접근 제한

  • BlockMoverFromMoversBrowse 추가 후 app/movers/layout에 적용하였습니다.
  • 기사님이 공개페이지 (기사님 찾기, 그 아래 상세 페이지 등) 에 접근할 시 받은 요청으로 리디렉트 합니다.

✅ 체크리스트

  • 로컬에서 정상 동작을 확인했습니다.
  • 기존 기능에 영향을 주지 않는지 확인했습니다.
  • 불필요한 console.log를 제거했습니다.
  • lint를 통과했습니다.
  • README 또는 문서를 수정했습니다. (필요 시)
  • API 명세와 일치하는지 확인했습니다.

💬 To Reviewer

  • 기사님이 접근할 시 공개페이지 (movers) 를 다 막는게 맞는지 확인 부탁드리겠습니다.
  • 최대한 배포 페이지에서 이것저것 눌러보며 auth 쪽 보긴 했는데, 추가될 수정사항이 있으면 말씀주세요!

Summary by CodeRabbit

  • 새 기능
    • 이사 전문가 계정이 이사 찾기 화면에 접근하면 역할에 맞는 홈 화면으로 자동 이동합니다.
    • 인증 상태가 확인되는 동안에도 역할에 맞는 화면 접근이 안정적으로 처리됩니다.
    • 로그인 사용자의 역할과 프로필 완료 상태에 따라 적절한 화면으로 안내됩니다.
  • 버그 수정
    • 로그인 후 예약된 이동 경로와 화면 상태가 안정적으로 처리됩니다.
    • 비밀번호 표시 토글 버튼이 키보드 탭 이동 순서에서 제외됩니다.
  • 문서
    • 인증 후 기본 이동 경로와 프로필 상태에 대한 안내를 보완했습니다.

@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
moving-frontend Ready Ready Preview Aug 7, 2026 2:46am
moving-frontend-p2ol Ready Ready Preview Aug 7, 2026 2:46am

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@9g-g9, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a3deed3f-6b27-4ce5-b9ee-f73fefc4ed50

📥 Commits

Reviewing files that changed from the base of the PR and between 44da5bc and a1cde50.

📒 Files selected for processing (1)
  • src/components/common/Header/Header.tsx
📝 Walkthrough

Walkthrough

서버 쿠키의 역할 힌트와 인증 저장소 상태를 사용해 MOVER의 movers 브라우즈 접근을 제한합니다. GuestOnly는 예약 경로, 역할, 프로필 완료 상태를 기준으로 비동기 리디렉션을 수행합니다. 비밀번호 토글 버튼은 탭 이동 대상에서 제외됩니다.

Changes

인증 및 접근 경로

Layer / File(s) Summary
이동자 브라우즈 접근 차단
src/app/movers/layout.tsx, src/components/auth/BlockMoverFromMoversBrowse.tsx, src/hooks/auth/useResolvedAuthRole.ts, src/components/common/Header/Header.tsx
MoversLayout이 쿠키에서 initialRole을 생성해 전달합니다. BlockMoverFromMoversBrowse는 인증 확인 전에도 MOVER 콘텐츠를 숨기고, 인증된 MOVER를 역할 홈으로 이동합니다. Header는 공통 역할 해석 훅을 사용합니다.
역할 기반 인증 후 리디렉션
src/components/auth/GuestOnly.tsx, src/lib/auth/redirect.ts
예약 경로를 먼저 소비합니다. 예약 경로가 없으면 역할과 프로필 완료 상태에 따른 목적지를 비동기로 조회합니다. 취소된 흐름에서는 라우팅하지 않습니다. 리디렉션 주석을 갱신합니다.
비밀번호 입력 키보드 이동
src/components/common/Input/PasswordInput.tsx
비밀번호 표시 토글 버튼에 tabIndex={-1}을 설정합니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MoversLayout
  participant BlockMoverFromMoversBrowse
  participant AuthStore
  participant Router
  MoversLayout->>BlockMoverFromMoversBrowse: initialRole 전달
  BlockMoverFromMoversBrowse->>AuthStore: 인증 상태와 역할 확인
  BlockMoverFromMoversBrowse->>Router: 인증된 MOVER를 역할 홈으로 이동
Loading

Possibly related PRs

Suggested reviewers: yooseohyeon

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 로그인·회원가입 후 뒤로가기 리디렉트 개선은 주요 변경 사항과 직접 관련되며, 추가 수정 사항도 포괄적으로 표현합니다.
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.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch fix/auth-login-fix
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/auth-login-fix

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/auth/GuestOnly.tsx (1)

35-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

리디렉션 주석을 실제 동작과 일치시키세요.

예약 경로가 없을 때 이 코드는 즉시 역할 홈으로 이동하지 않습니다. getPostAuthRedirectPath가 프로필 완료 상태를 조회하고, 미완료 사용자는 프로필 생성 경로로 이동합니다. 역할 홈은 조회 실패 시 fallback입니다.

수정안
-    // 예약된 경로가 없으면 역할 홈으로 이동
-    // 예약된 경로가 있으면 예약된 경로로 이동
+    // 예약된 경로가 있으면 해당 경로로 이동
+    // 예약된 경로가 없으면 역할과 프로필 완료 상태로 목적지를 결정
🤖 Prompt for 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.

In `@src/components/auth/GuestOnly.tsx` around lines 35 - 48, Update the Korean
comments above redirect so they accurately describe the actual behavior: a
reserved path is used when available; otherwise getPostAuthRedirectPath checks
profile completion, routes incomplete users to profile creation, and uses the
role home only as the lookup-failure fallback. Do not change the redirect logic.
🤖 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.

Nitpick comments:
In `@src/components/auth/GuestOnly.tsx`:
- Around line 35-48: Update the Korean comments above redirect so they
accurately describe the actual behavior: a reserved path is used when available;
otherwise getPostAuthRedirectPath checks profile completion, routes incomplete
users to profile creation, and uses the role home only as the lookup-failure
fallback. Do not change the redirect logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a628a7a-095c-4886-967c-dfab37c45bf2

📥 Commits

Reviewing files that changed from the base of the PR and between d54cfd4 and a994b4f.

📒 Files selected for processing (5)
  • src/app/movers/layout.tsx
  • src/components/auth/BlockMoverFromMoversBrowse.tsx
  • src/components/auth/GuestOnly.tsx
  • src/components/common/Input/PasswordInput.tsx
  • src/lib/auth/redirect.ts

@juengseulki juengseulki 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.

📋 PR 리뷰

👍 좋았던 점

  • 로그인·회원가입 이후 뒤로가기로 인증 페이지에 재진입했을 때, 단순히 역할 홈으로 보내지 않고 프로필 완료 여부를 다시 확인하도록 보완했습니다.
  • 보호 페이지에서 로그인으로 이동하며 저장한 예약 경로가 있으면 해당 경로를 우선 사용해 기존 사용자 의도를 유지했습니다.
  • 예약 경로가 없는 경우에만 getPostAuthRedirectPath()를 호출해 불필요한 Profile Status 조회를 줄였습니다.
  • 회원가입 직후 /signup으로 뒤로가더라도 프로필 미완료 사용자는 프로필 생성 화면으로, 완료 사용자는 역할 홈으로 이동하도록 구성했습니다.
  • Profile Status 조회 실패 시 역할 홈으로 이동하는 기존 fallback 정책을 재사용했습니다.
  • 비동기 Redirect 과정에 cleanup 상태를 두어 언마운트 이후 Redirect가 실행되는 상황을 방어했습니다.
  • 기사 계정의 /movers 접근 제한을 별도 Guard 컴포넌트로 분리해 Layout의 책임을 단순하게 유지했습니다.
  • 인증 Hydration과 checkAuth가 완료된 뒤에만 MOVER 여부를 판단해 초기 잘못된 Redirect를 방지했습니다.
  • Redirect 대상인 경우 children을 렌더링하지 않아 제한된 페이지의 순간 노출과 불필요한 하위 동작을 줄였습니다.
  • 기존 LoginRequiredModalProvider 구조를 유지해 비로그인·Customer의 기사 찾기 흐름에 미치는 영향을 최소화했습니다.
  • 현재 PR은 열려 있고 병합 가능한 상태이며, 변경 파일 5개로 수정 범위가 명확합니다.

🔍 확인 및 제안

필수 수정사항은 보이지 않았습니다.

가장 중요한 확인 사항은 MOVER 계정의 /movers 접근 제한 범위입니다.

현재 Guard가 /movers Layout에 적용되어 있기 때문에 다음 경로가 모두 차단됩니다.

  • 기사님 찾기 목록
  • 기사님 상세
  • 기사 추천 또는 지도 화면
  • 앞으로 추가되는 /movers 하위 공개 페이지

서비스 정책이 “기사 찾기 도메인은 Customer와 비로그인 사용자 전용”이라면 현재 구조가 가장 일관적입니다.

반대로 기사님도 다른 기사님의 공개 프로필이나 공유받은 상세 페이지를 볼 수 있어야 한다면,
Layout 전체를 막기보다는 목록·추천 화면에만 Guard를 적용하고 상세 페이지는 허용하는 편이 적절합니다.

전체적으로 로그인·회원가입 직후 History 이동에서 발생하던 인증 페이지 재노출 문제를
기존 Redirect 정책을 재사용해 깔끔하게 보완한 것으로 보입니다.

수고하셨습니다! 😊


To Reviewer 내용 기준으로 기사 계정의 /movers 접근 제한 범위와
인증 페이지 뒤로가기 흐름을 중점적으로 확인했습니다!

로그인·회원가입 이후 뒤로가기로 인증 페이지에 다시 접근했을 때의 흐름은 적절해 보입니다.

예약된 이동 경로가 있으면 해당 경로를 우선 사용하고,
예약 경로가 없는 경우에만 역할과 프로필 완료 여부를 확인해 이동합니다.

따라서 다음과 같이 동작합니다.

  • 보호 기능에서 로그인 후 인증 페이지 재진입
    → 기존에 예약한 목적지로 이동
  • 회원가입 직후 /signup으로 뒤로가기
    → 프로필 미완료면 프로필 생성 화면
  • 프로필 완료 사용자
    → 역할 홈
  • 프로필 Status 조회 실패
    → 역할 홈

가입 직후 뒤로가기로 가입 폼에 다시 머무는 문제와,
프로필 미완료 사용자가 역할 홈으로 먼저 이동하는 문제를 함께 보완한 것으로 확인했습니다.

기사 계정의 /movers 접근을 모두 막는 것이 맞는지는 서비스 정책에 따라 결정하는 것이 좋습니다.

현재 구현은 /movers Layout에 Guard가 있으므로
기사 목록뿐 아니라 상세와 추천 등 모든 하위 페이지를 차단합니다.

아래 정책이라면 현재 구조가 적절합니다.

  • 기사 찾기 기능은 Customer 전용
  • 기사 계정은 다른 기사를 탐색할 필요가 없음
  • 기사 상세 공유 링크도 기사 계정에서는 역할 홈으로 이동

반대로 아래 요구가 있다면 범위를 좁히는 편이 좋습니다.

  • 기사도 다른 기사님의 공개 프로필을 볼 수 있음
  • 외부에서 공유받은 기사 상세 링크는 로그인 역할과 관계없이 열 수 있음
  • 목록과 추천만 Customer 전용이고 상세는 공개 페이지로 유지

이 경우에는 /movers 전체 Layout이 아니라
기사 목록·추천 화면에만 BlockMoverFromMoversBrowse를 적용하는 방식이 더 적절합니다.

현재 서비스에서 기사 찾기가 고객의 기사 선택 기능으로 정의되어 있다면
목록과 추천을 막는 것은 맞고,
상세까지 막을지는 공개 프로필 정책을 한 번 확인하면 좋겠습니다.

Comment thread src/components/auth/GuestOnly.tsx Outdated
Comment thread src/app/movers/layout.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/auth/GuestOnly.tsx (1)

40-54: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

예약 경로 처리 뒤 redirect를 종료하세요.

Line 43에서 reservedPath로 이동한 뒤에도 함수가 계속 실행됩니다. 이후 getPostAuthRedirectPath가 완료되면 Line 54가 다시 router.replace(intentPath)를 호출합니다. 이 호출이 예약 경로 이동을 역할 홈 또는 프로필 생성 경로로 덮어쓸 수 있습니다.

consumePostAuthRedirectPath() 뒤에 return을 추가하세요.

수정 예시
       if (reservedPath) {
         if (cancelled) return;

         router.replace(reservedPath);
         useAuthStore.getState().consumePostAuthRedirectPath();
+        return;
       }
🤖 Prompt for 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.

In `@src/components/auth/GuestOnly.tsx` around lines 40 - 54, Update the
reservedPath branch in GuestOnly so it returns immediately after
router.replace(reservedPath) and consumePostAuthRedirectPath(), preventing the
later getPostAuthRedirectPath flow from replacing the reserved redirect.
🤖 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.

Outside diff comments:
In `@src/components/auth/GuestOnly.tsx`:
- Around line 40-54: Update the reservedPath branch in GuestOnly so it returns
immediately after router.replace(reservedPath) and
consumePostAuthRedirectPath(), preventing the later getPostAuthRedirectPath flow
from replacing the reserved redirect.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c3f53981-999b-421d-a5aa-88b14e96e833

📥 Commits

Reviewing files that changed from the base of the PR and between a994b4f and 88b5106.

📒 Files selected for processing (1)
  • src/components/auth/GuestOnly.tsx

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants