From ef4c533ebacc2cdc97e518f30e9a9350004fcdfb Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 28 Apr 2025 02:13:30 +0000 Subject: ~20250428 작업사항 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/login/login-form.tsx | 67 ++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 14 deletions(-) (limited to 'components/login/login-form.tsx') diff --git a/components/login/login-form.tsx b/components/login/login-form.tsx index 92fa6e2c..7236c02e 100644 --- a/components/login/login-form.tsx +++ b/components/login/login-form.tsx @@ -5,7 +5,7 @@ import { cn } from "@/lib/utils" import { Button } from "@/components/ui/button" import { Card, CardContent } from "@/components/ui/card" import { Input } from "@/components/ui/input" -import { SendIcon, Loader2, GlobeIcon, ChevronDownIcon, Ship } from "lucide-react"; +import { SendIcon, Loader2, GlobeIcon, ChevronDownIcon, Ship, InfoIcon } from "lucide-react"; import { useToast } from "@/hooks/use-toast"; import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem } from "@/components/ui/dropdown-menu" import { useTranslation } from '@/i18n/client' @@ -55,6 +55,10 @@ export function LoginForm({ const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); + const goToVendorRegistration = () => { + router.push(`/${lng}/partners/repository`); + }; + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); @@ -114,7 +118,24 @@ export function LoginForm({ description: t('youAreLoggedIn'), }); - router.push(`/${lng}/partners/dashboard`); + const callbackUrlParam = searchParams?.get('callbackUrl'); + + if (callbackUrlParam) { + try { + // URL 객체로 파싱 + const callbackUrl = new URL(callbackUrlParam); + + // pathname + search만 사용 (호스트 제거) + const relativeUrl = callbackUrl.pathname + callbackUrl.search; + router.push(relativeUrl); + } catch (e) { + // 유효하지 않은 URL이면 그대로 사용 (이미 상대 경로일 수 있음) + router.push(callbackUrlParam); + } + } else { + // callbackUrl이 없으면 기본 대시보드로 리다이렉트 + router.push(`/${lng}/partners/dashboard`); + } } else { toast({ @@ -232,7 +253,8 @@ export function LoginForm({ href="/partners/repository" className={cn(buttonVariants({ variant: "ghost" }))} > - Request Vendor Repository + + {'업체 등록 신청'} @@ -242,14 +264,21 @@ export function LoginForm({
{/* Here's your existing login/OTP forms: */} - {!otpSent ? ( -
+ {/* {!otpSent ? ( */} + + {/* */} +
-
-

{t('loginMessage')}

-
+
+

{t('loginMessage')}

+ + {/* 설명 텍스트 추가 - 업체 등록 관련 안내 */} +

+ {'등록된 업체만 로그인하실 수 있습니다. 아직 등록되지 않은 업체라면 상단의 업체 등록 신청 버튼을 이용해주세요.'} +

+
- {/* S-chips 로그인 폼이 표시되지 않을 때만 이메일 입력 필드 표시 */} + {/* S-Gips 로그인 폼이 표시되지 않을 때만 이메일 입력 필드 표시 */} {!showCredentialsForm && ( <>
@@ -279,15 +308,25 @@ export function LoginForm({
- {/* S-chips 로그인 버튼 */} + {/* S-Gips 로그인 버튼 */} + + {/* 업체 등록 안내 링크 추가 */} + )} @@ -298,7 +337,7 @@ export function LoginForm({ setUsername(e.target.value)} @@ -360,7 +399,7 @@ export function LoginForm({
- ) : ( + {/* ) : (
@@ -411,7 +450,7 @@ export function LoginForm({
- )} + )} */}
{t('termsMessage')} {t('termsOfService')} {t('and')} -- cgit v1.2.3