fix(products): 모달 401 세션만료 처리 + callback open redirect 방어 + 초기 포커스

- BankTransferModal: POST /api/orders 401 응답 시 setAuthState('guest')로 전환 (에러 텍스트 대신 로그인 유도 UI 복귀)
- BankTransferModal: 모달 열릴 때 closeBtnRef.current?.focus() 호출 (접근성 초기 포커스)
- auth/callback: next 파라미터를 safeNext 패턴으로 검증 — startsWith('/') && !startsWith('//') && !startsWith('/\') 미충족 시 /mypage 폴백

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 09:11:05 +09:00
parent 199dae0ee5
commit 8dafb98f47
2 changed files with 15 additions and 1 deletions

View File

@@ -4,7 +4,11 @@ import { createClient } from '@/lib/supabase/server';
export async function GET(request: Request) {
const { searchParams, origin } = new URL(request.url);
const code = searchParams.get('code');
const next = searchParams.get('next') ?? '/mypage';
const rawNext = searchParams.get('next') ?? '/mypage';
const next =
rawNext.startsWith('/') && !rawNext.startsWith('//') && !rawNext.startsWith('/\\')
? rawNext
: '/mypage';
// 리다이렉트 기준 URL 결정
// - dev: 항상 현재 request의 origin (localhost) → NEXT_PUBLIC_SITE_URL 무시