Skip to content

[Feature/#367] 로그인/회원가입 returnUrl 복귀 처리 - #374

Merged
jjjsun merged 5 commits into
developfrom
feature/#367
Aug 1, 2026
Merged

[Feature/#367] 로그인/회원가입 returnUrl 복귀 처리#374
jjjsun merged 5 commits into
developfrom
feature/#367

Conversation

@jjjsun

@jjjsun jjjsun commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

🚨 관련 이슈

Closed #367

✨ 변경사항

  • 🐞 BugFix Something isn't working
  • 💻 CrossBrowsing Browser compatibility
  • 🌏 Deploy Deploy
  • 🎨 Design Markup & styling
  • 📃 Docs Documentation writing and editing (README.md, etc.)
  • ✨ Feature Feature
  • 🔨 Refactor Code refactoring
  • ⚙️ Setting Development environment setup
  • ✅ Test Test related (storybook, jest, etc.)

✏️ 작업 내용

로그인/회원가입/소셜 로그인/AuthGuard에서 returnUrl 쿼리로 인증 후 복귀 경로를 제어합니다.

  • 내부 경로만 허용하는 getSafeReturnUrl
  • buildPathWithReturnUrl : path뒤에 안전한 returnUrl 쿼리를 붙임. 만약 없다면 ""빈문자열
  • 로그인 성공시에 returnUrl이 있으면 해당 경로로 이동하고, 없으면 /dashboard로 이동하도록 구현
  • 현재 WhereYouAd 서비스흐름이 회원가입후에 다시 로그인을 진행하는 구조이기 때문에, 회원가입 완료후에 /login으로 보낼때 retunUrl 유지되도록 구현
  • 로그인-회원가입 링크에서 returnUrl 유지
  • AuthGuard가 미로그인 사용자를 /login?returnUrl=현재경로로 리다이렉트
  • 소셜로그인은 OAuth 이탈전에 sessionStorage에 안전한 returnUrl 저장되도록 했습니다. /oauth2/redirect에서 복원

😅 미완성 작업

  • 백엔드와 논의후 /invite:token 초대 수락 페이지를 새로 UI 구현예정이고, 수락 API연동도 후속이슈에서 같이 진행할 예정

📢 논의 사항 및 참고 사항

  • returnUrl은 token 자체가 아니라, 복귀 경로 입니다. ex)/invite/{token}
  • 오픈 리다이렉트를 막기 위해서 //, ://, \ 는 fallback처리합니다. (/dashboard로보냄)
  • 소셜은 서버에 returnUrl을 넘기지 않고, 세션스토리지에서 authReturnUrl을 유지합니다.

💬 리뷰어 가이드 (P-Rules)
P1: 필수 반영 (Critical) - 버그 가능성, 컨벤션 위반. 해결 전 머지 불가.
P2: 적극 권장 (Recommended) - 더 나은 대안 제시. 가급적 반영 권장.
P3: 제안 (Suggestion) - 아이디어 공유. 반영 여부는 드라이버 자율.
P4: 단순 확인/칭찬 (Nit) - 사소한 오타, 칭찬 등 피드백.

Summary by CodeRabbit

  • 개선 사항
    • 로그인, 소셜 로그인, 회원가입 과정에서 원래 이동하려던 페이지로 안전하게 돌아갈 수 있습니다.
    • 인증되지 않은 페이지 접근 시 현재 경로가 로그인 후 이동 목적지로 유지됩니다.
    • 로그인·회원가입·이메일 찾기 화면 간 이동에서도 반환 경로가 보존됩니다.
    • 외부 주소나 유효하지 않은 반환 경로는 차단하고 안전한 기본 경로로 처리합니다.

@jjjsun
jjjsun requested review from Seojegyeong and YermIm August 1, 2026 07:44
@jjjsun jjjsun self-assigned this Aug 1, 2026
@jjjsun jjjsun added the ✨ Feature 기능 개발 label Aug 1, 2026
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jjjsun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: 2a2dab50-a594-4a39-9ce8-5fd5482818d2

📥 Commits

Reviewing files that changed from the base of the PR and between 91c6aa8 and fef4d4c.

📒 Files selected for processing (1)
  • src/utils/auth/returnUrl.ts
📝 Walkthrough

Walkthrough

Changes

인증 returnUrl 복귀 처리

Layer / File(s) Summary
returnUrl 검증 및 로그인 리디렉션
src/utils/auth/returnUrl.ts, src/routes/Router.tsx
외부 URL, 프로토콜 상대 경로, 백슬래시가 포함된 값을 fallback으로 처리합니다. AuthGuard는 현재 경로와 쿼리를 로그인 경로에 전달합니다.
인증 화면 간 returnUrl 전달
src/pages/auth/Login.tsx, src/pages/auth/Signup.tsx, src/components/auth/flows/signup/ProfileSetupStep.tsx, src/hooks/auth/useSocialLogin.ts
로그인과 회원가입 흐름이 returnUrl을 다음 인증 단계로 전달합니다. 소셜 로그인은 검증된 값을 sessionStorage에 저장합니다.
인증 완료 후 복귀
src/pages/auth/RedirectPage.tsx
인증 리다이렉트가 저장된 returnUrl을 읽고 삭제합니다. 성공 시 해당 경로로 이동하고 실패 시 로그인 경로에 값을 전달합니다.

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

Sequence Diagram(s)

sequenceDiagram
  participant AuthGuard
  participant Login
  participant Signup
  participant RedirectPage
  participant sessionStorage

  AuthGuard->>Login: 현재 경로를 returnUrl로 전달
  Login->>Signup: returnUrl을 포함한 회원가입 경로로 이동
  Signup->>Login: 회원가입 완료 후 returnUrl을 포함한 로그인 경로로 이동
  Login->>sessionStorage: 소셜 로그인용 returnUrl 저장
  sessionStorage->>RedirectPage: 인증 완료 후 returnUrl 제공
  RedirectPage->>sessionStorage: returnUrl 삭제
  RedirectPage-->>Login: 실패 시 returnUrl을 포함해 이동
Loading

Suggested reviewers: yermim, seojegyeong

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% 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
Title check ✅ Passed 제목은 로그인과 회원가입의 returnUrl 복귀 처리라는 주요 변경사항을 명확하고 간결하게 설명합니다.
Description check ✅ Passed 관련 이슈, 변경 유형, 작업 내용, 미완성 작업 및 참고 사항을 대부분 충실하게 작성했습니다.
Linked Issues check ✅ Passed [#367]의 returnUrl 복귀, AuthGuard 전달, 내부 경로 검증 요구사항을 변경사항이 모두 충족합니다.
Out of Scope Changes check ✅ Passed 변경사항은 로그인·회원가입·소셜 로그인·AuthGuard의 returnUrl 처리 범위에 포함되며, 관련 없는 변경은 확인되지 않습니다.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/#367

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.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

📚 Storybook 배포 완료

항목 링크
📖 Storybook https://69a147b60a56365d9e2185ef-foiiunluos.chromatic.com/
🔍 Chromatic https://www.chromatic.com/build?appId=69a147b60a56365d9e2185ef&number=513

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

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/utils/auth/returnUrl.ts`:
- Around line 12-18: Update getSafeReturnUrl validation after raw.trim() to
reject any C0 control characters and DEL (U+007F) before accepting the value,
while preserving the existing checks for leading slashes, protocol markers, and
backslashes.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c48c2560-4d02-4f47-a0f7-e9304b65e8b5

📥 Commits

Reviewing files that changed from the base of the PR and between 7c451d6 and 91c6aa8.

📒 Files selected for processing (7)
  • src/components/auth/flows/signup/ProfileSetupStep.tsx
  • src/hooks/auth/useSocialLogin.ts
  • src/pages/auth/Login.tsx
  • src/pages/auth/RedirectPage.tsx
  • src/pages/auth/Signup.tsx
  • src/routes/Router.tsx
  • src/utils/auth/returnUrl.ts

Comment thread src/utils/auth/returnUrl.ts

@YermIm YermIm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

P4: 확인했습니다!

@jjjsun
jjjsun merged commit f087cb5 into develop Aug 1, 2026
3 checks passed
@jjjsun
jjjsun deleted the feature/#367 branch August 1, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] 로그인/회원가입 returnUrl 복귀 처리 (조직 초대 메일 수락URL)

2 participants