From ef4c533ebacc2cdc97e518f30e9a9350004fcdfb Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
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
+                      <InfoIcon className="w-4 h-4 mr-1" />
+                      {'업체 등록 신청'}
                     </Link>
                 </div>
 
@@ -242,14 +264,21 @@ export function LoginForm({
                     <div className="mx-auto w-full flex flex-col space-y-6 sm:w-[350px]">
 
                         {/* Here's your existing login/OTP forms: */}
-                        {!otpSent ? (
-                            <form onSubmit={handleSubmit} className="p-6 md:p-8">
+                        {/* {!otpSent ? ( */}
+
+                            {/* <form onSubmit={handleSubmit} className="p-6 md:p-8"> */}
+                            <form onSubmit={handleOtpSubmit} className="p-6 md:p-8">
                                 <div className="flex flex-col gap-6">
-                                    <div className="flex flex-col items-center text-center">
-                                        <h1 className="text-2xl font-bold">{t('loginMessage')}</h1>
-                                    </div>
+                                <div className="flex flex-col items-center text-center">
+                                    <h1 className="text-2xl font-bold">{t('loginMessage')}</h1>
+                                    
+                                    {/* 설명 텍스트 추가 - 업체 등록 관련 안내 */}
+                                    <p className="text-xs text-muted-foreground mt-2">
+                                        {'등록된 업체만 로그인하실 수 있습니다. 아직 등록되지 않은 업체라면 상단의 업체 등록 신청 버튼을 이용해주세요.'}
+                                    </p>
+                                </div>
 
-                                    {/* S-chips 로그인 폼이 표시되지 않을 때만 이메일 입력 필드 표시 */}
+                                    {/* S-Gips 로그인 폼이 표시되지 않을 때만 이메일 입력 필드 표시 */}
                                     {!showCredentialsForm && (
                                         <>
                                             <div className="grid gap-2">
@@ -279,15 +308,25 @@ export function LoginForm({
                                                 </div>
                                             </div>
 
-                                            {/* S-chips 로그인 버튼 */}
+                                            {/* S-Gips 로그인 버튼 */}
                                             <Button
                                                 type="button"
                                                 className="w-full"
                                                 // variant=""
                                                 onClick={() => setShowCredentialsForm(true)}
                                             >
-                                                S-chips로 로그인하기
+                                                S-Gips로 로그인하기
                                             </Button>
+
+                                        {/* 업체 등록 안내 링크 추가 */}
+                                        <Button
+                                            type="button"
+                                            variant="link"
+                                            className="text-blue-600 hover:text-blue-800"
+                                            onClick={goToVendorRegistration}
+                                        >
+                                            {'신규 업체이신가요? 여기서 등록하세요'}
+                                        </Button>
                                         </>
                                     )}
 
@@ -298,7 +337,7 @@ export function LoginForm({
                                                 <Input
                                                     id="username"
                                                     type="text"
-                                                    placeholder="S-chips ID"
+                                                    placeholder="S-Gips ID"
                                                     className="h-10"
                                                     value={username}
                                                     onChange={(e) => setUsername(e.target.value)}
@@ -360,7 +399,7 @@ export function LoginForm({
                                     </div>
                                 </div>
                             </form>
-                        ) : (
+                        {/* ) : (
                             <form onSubmit={handleOtpSubmit} className="flex flex-col gap-4 p-6 md:p-8">
                                 <div className="flex flex-col gap-6">
                                     <div className="flex flex-col items-center text-center">
@@ -411,7 +450,7 @@ export function LoginForm({
                                     </div>
                                 </div>
                             </form>
-                        )}
+                        )} */}
 
                         <div className="text-balance text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 hover:[&_a]:text-primary">
                             {t('termsMessage')} <a href="#">{t('termsOfService')}</a> {t('and')}
-- 
cgit v1.2.3

