회원가입
This commit is contained in:
57
app/auth/callback/route.ts
Normal file
57
app/auth/callback/route.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* [인증 콜백 라우트 핸들러]
|
||||
*
|
||||
* Supabase 인증 이메일(회원가입 확인, 비밀번호 재설정 등)에서
|
||||
* 리다이렉트될 때 호출되는 API 라우트입니다.
|
||||
*
|
||||
* PKCE(Proof Key for Code Exchange) 흐름:
|
||||
* 1. 사용자가 이메일 링크 클릭
|
||||
* 2. Supabase 서버가 토큰 검증 후 이 라우트로 `code` 파라미터와 함께 리다이렉트
|
||||
* 3. 이 라우트에서 `code`를 세션으로 교환
|
||||
* 4. 원래 목적지(next 파라미터)로 리다이렉트
|
||||
*
|
||||
* @param request - Next.js Request 객체
|
||||
*/
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams, origin } = new URL(request.url);
|
||||
|
||||
// 1. URL에서 code와 next(리다이렉트 목적지) 추출
|
||||
const code = searchParams.get("code");
|
||||
const next = searchParams.get("next") ?? "/";
|
||||
|
||||
// 2. code가 있으면 세션으로 교환
|
||||
if (code) {
|
||||
const supabase = await createClient();
|
||||
const { error } = await supabase.auth.exchangeCodeForSession(code);
|
||||
|
||||
if (!error) {
|
||||
// 3. 세션 교환 성공 - 원래 목적지로 리다이렉트
|
||||
// next가 절대 URL(http://...)이면 그대로 사용, 아니면 origin + next
|
||||
const forwardedHost = request.headers.get("x-forwarded-host"); // 프록시 환경 대응
|
||||
const isLocalEnv = process.env.NODE_ENV === "development";
|
||||
|
||||
if (isLocalEnv) {
|
||||
// 개발 환경: localhost 사용
|
||||
return NextResponse.redirect(`${origin}${next}`);
|
||||
} else if (forwardedHost) {
|
||||
// 프로덕션 + 프록시: x-forwarded-host 사용
|
||||
return NextResponse.redirect(`https://${forwardedHost}${next}`);
|
||||
} else {
|
||||
// 프로덕션: origin 사용
|
||||
return NextResponse.redirect(`${origin}${next}`);
|
||||
}
|
||||
}
|
||||
|
||||
// 에러 발생 시 로그 출력
|
||||
console.error("Auth callback error:", error.message);
|
||||
}
|
||||
|
||||
// 4. code가 없거나 교환 실패 시 에러 페이지로 리다이렉트
|
||||
const errorMessage = encodeURIComponent(
|
||||
"인증 링크가 만료되었거나 유효하지 않습니다.",
|
||||
);
|
||||
return NextResponse.redirect(`${origin}/login?message=${errorMessage}`);
|
||||
}
|
||||
76
app/auth/confirm/route.ts
Normal file
76
app/auth/confirm/route.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import { AUTH_ERROR_MESSAGES } from "@/features/auth/constants";
|
||||
import { type EmailOtpType } from "@supabase/supabase-js";
|
||||
import { redirect } from "next/navigation";
|
||||
import { type NextRequest } from "next/server";
|
||||
|
||||
// ========================================
|
||||
// 상수 정의
|
||||
// ========================================
|
||||
|
||||
/** 비밀번호 재설정 후 이동할 경로 */
|
||||
const RESET_PASSWORD_PATH = "/reset-password";
|
||||
|
||||
/** 인증 실패 시 리다이렉트할 경로 */
|
||||
const LOGIN_PATH = "/login";
|
||||
|
||||
// ========================================
|
||||
// 라우트 핸들러
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* [이메일 인증 확인 라우트]
|
||||
*
|
||||
* Supabase 이메일 템플릿의 인증 링크를 처리합니다.
|
||||
* - 회원가입 이메일 확인
|
||||
* - 비밀번호 재설정
|
||||
*
|
||||
* @example Supabase 이메일 템플릿 형식
|
||||
* {{ .SiteURL }}/auth/confirm?token_hash={{ .TokenHash }}&type=recovery
|
||||
*/
|
||||
export async function GET(request: NextRequest) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
|
||||
// ========== 파라미터 추출 ==========
|
||||
const tokenHash = searchParams.get("token_hash");
|
||||
const type = searchParams.get("type") as EmailOtpType | null;
|
||||
const rawNext = searchParams.get("next");
|
||||
|
||||
// 보안: 외부 URL 리다이렉트 방지 (상대 경로만 허용)
|
||||
const nextPath = rawNext?.startsWith("/") ? rawNext : "/";
|
||||
|
||||
// ========== 토큰 검증 ==========
|
||||
if (!tokenHash || !type) {
|
||||
return redirectWithError(AUTH_ERROR_MESSAGES.INVALID_AUTH_LINK);
|
||||
}
|
||||
|
||||
const supabase = await createClient();
|
||||
const { error } = await supabase.auth.verifyOtp({
|
||||
type,
|
||||
token_hash: tokenHash,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error("[Auth Confirm] verifyOtp 실패:", error.message);
|
||||
return redirectWithError(AUTH_ERROR_MESSAGES.INVALID_AUTH_LINK);
|
||||
}
|
||||
|
||||
// ========== 검증 성공 - 적절한 페이지로 리다이렉트 ==========
|
||||
if (type === "recovery") {
|
||||
redirect(RESET_PASSWORD_PATH);
|
||||
}
|
||||
|
||||
redirect(nextPath);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// 헬퍼 함수
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* 에러 메시지와 함께 로그인 페이지로 리다이렉트
|
||||
*/
|
||||
function redirectWithError(message: string): never {
|
||||
const encodedMessage = encodeURIComponent(message);
|
||||
redirect(`${LOGIN_PATH}?message=${encodedMessage}`);
|
||||
}
|
||||
BIN
app/favicon.ico
Normal file
BIN
app/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
108
app/forgot-password/page.tsx
Normal file
108
app/forgot-password/page.tsx
Normal file
@@ -0,0 +1,108 @@
|
||||
import FormMessage from "@/components/form-message";
|
||||
import { requestPasswordReset } from "@/features/auth/actions";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import Link from "next/link";
|
||||
|
||||
/**
|
||||
* [비밀번호 찾기 페이지]
|
||||
*
|
||||
* 사용자가 이메일을 입력하면 비밀번호 재설정 링크를 이메일로 발송합니다.
|
||||
* 로그인/회원가입 페이지와 동일한 디자인 시스템 사용
|
||||
*
|
||||
* @param searchParams - URL 쿼리 파라미터 (에러 메시지 전달용)
|
||||
*/
|
||||
export default async function ForgotPasswordPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ message: string }>;
|
||||
}) {
|
||||
// URL에서 메시지 파라미터 추출
|
||||
const { message } = await searchParams;
|
||||
|
||||
return (
|
||||
<div className="relative flex min-h-screen items-center justify-center overflow-hidden bg-gradient-to-br from-indigo-50 via-purple-50 to-pink-50 px-4 py-12 dark:from-gray-950 dark:via-indigo-950 dark:to-purple-950">
|
||||
{/* ========== 배경 그라디언트 ========== */}
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-indigo-200/40 via-purple-200/20 to-transparent dark:from-indigo-900/30 dark:via-purple-900/20" />
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,_var(--tw-gradient-stops))] from-pink-200/40 via-purple-200/20 to-transparent dark:from-pink-900/30 dark:via-purple-900/20" />
|
||||
|
||||
{/* ========== 애니메이션 블러 효과 ========== */}
|
||||
<div className="absolute left-1/4 top-1/4 h-64 w-64 animate-pulse rounded-full bg-indigo-400/30 blur-3xl dark:bg-indigo-600/20" />
|
||||
<div className="absolute bottom-1/4 right-1/4 h-64 w-64 animate-pulse rounded-full bg-purple-400/30 blur-3xl delay-700 dark:bg-purple-600/20" />
|
||||
|
||||
{/* ========== 메인 콘텐츠 ========== */}
|
||||
<div className="relative z-10 w-full max-w-md animate-in fade-in slide-in-from-bottom-4 duration-700">
|
||||
{/* 에러/성공 메시지 */}
|
||||
<FormMessage message={message} />
|
||||
|
||||
{/* ========== 비밀번호 찾기 카드 ========== */}
|
||||
<Card className="border-white/20 bg-white/70 shadow-2xl backdrop-blur-xl dark:border-white/10 dark:bg-gray-900/70">
|
||||
<CardHeader className="space-y-3 text-center">
|
||||
{/* 아이콘 */}
|
||||
<div className="mx-auto mb-2 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg">
|
||||
<span className="text-4xl">🔑</span>
|
||||
</div>
|
||||
{/* 페이지 제목 */}
|
||||
<CardTitle className="text-3xl font-bold tracking-tight">
|
||||
비밀번호 찾기
|
||||
</CardTitle>
|
||||
{/* 페이지 설명 */}
|
||||
<CardDescription className="text-base">
|
||||
가입하신 이메일 주소를 입력하시면
|
||||
<br />
|
||||
비밀번호 재설정 링크를 보내드립니다.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
{/* ========== 폼 영역 ========== */}
|
||||
<CardContent className="space-y-6">
|
||||
{/* 비밀번호 재설정 요청 폼 */}
|
||||
<form className="space-y-5">
|
||||
{/* ========== 이메일 입력 필드 ========== */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="email" className="text-sm font-medium">
|
||||
이메일
|
||||
</Label>
|
||||
<Input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
placeholder="your@email.com"
|
||||
autoComplete="email"
|
||||
required
|
||||
className="h-11 transition-all duration-200"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ========== 재설정 링크 발송 버튼 ========== */}
|
||||
<Button
|
||||
formAction={requestPasswordReset}
|
||||
className="h-11 w-full bg-gradient-to-r from-indigo-600 to-purple-600 font-semibold text-white shadow-lg transition-all hover:from-indigo-700 hover:to-purple-700 hover:shadow-xl"
|
||||
>
|
||||
재설정 링크 보내기
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
{/* ========== 로그인 페이지로 돌아가기 ========== */}
|
||||
<div className="text-center">
|
||||
<Link
|
||||
href="/login"
|
||||
className="text-sm font-medium text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-300"
|
||||
>
|
||||
← 로그인 페이지로 돌아가기
|
||||
</Link>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
125
app/globals.css
Normal file
125
app/globals.css
Normal file
@@ -0,0 +1,125 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: var(--font-geist-sans);
|
||||
--font-mono: var(--font-geist-mono);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--radius-2xl: calc(var(--radius) + 8px);
|
||||
--radius-3xl: calc(var(--radius) + 12px);
|
||||
--radius-4xl: calc(var(--radius) + 16px);
|
||||
}
|
||||
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
34
app/layout.tsx
Normal file
34
app/layout.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Geist, Geist_Mono } from "next/font/google";
|
||||
import "./globals.css";
|
||||
|
||||
const geistSans = Geist({
|
||||
variable: "--font-geist-sans",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
const geistMono = Geist_Mono({
|
||||
variable: "--font-geist-mono",
|
||||
subsets: ["latin"],
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
>
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
224
app/login/page.tsx
Normal file
224
app/login/page.tsx
Normal file
@@ -0,0 +1,224 @@
|
||||
import Link from "next/link";
|
||||
import { login } from "@/features/auth/actions";
|
||||
import FormMessage from "@/components/form-message";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
|
||||
/**
|
||||
* [로그인 페이지 컴포넌트]
|
||||
*
|
||||
* Modern UI with glassmorphism effect (유리 형태 디자인)
|
||||
* - 투명 배경 + 블러 효과로 깊이감 표현
|
||||
* - 그라디언트 배경으로 생동감 추가
|
||||
* - shadcn/ui 컴포넌트로 일관된 디자인 시스템 유지
|
||||
*
|
||||
* @param searchParams - URL 쿼리 파라미터 (에러 메시지 전달용)
|
||||
*/
|
||||
export default async function LoginPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ message: string }>;
|
||||
}) {
|
||||
// URL에서 메시지 파라미터 추출 (로그인 실패 시 에러 메시지 표시)
|
||||
const { message } = await searchParams;
|
||||
|
||||
return (
|
||||
<div className="relative flex min-h-screen items-center justify-center overflow-hidden bg-gradient-to-br from-indigo-50 via-purple-50 to-pink-50 px-4 py-12 dark:from-gray-950 dark:via-indigo-950 dark:to-purple-950">
|
||||
{/* ========== 배경 그라디언트 레이어 ========== */}
|
||||
{/* 웹 페이지 전체 배경을 그라디언트로 채웁니다 */}
|
||||
{/* 라이트 모드: 부드러운 파스텔 톤 (indigo → purple → pink) */}
|
||||
{/* 다크 모드: 진한 어두운 톤으로 눈부심 방지 */}
|
||||
|
||||
{/* 추가 그라디언트 효과 1: 우상단에서 시작하는 원형 그라디언트 */}
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-indigo-200/40 via-purple-200/20 to-transparent dark:from-indigo-900/30 dark:via-purple-900/20" />
|
||||
|
||||
{/* 추가 그라디언트 효과 2: 좌하단에서 시작하는 원형 그라디언트 */}
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,_var(--tw-gradient-stops))] from-pink-200/40 via-purple-200/20 to-transparent dark:from-pink-900/30 dark:via-purple-900/20" />
|
||||
|
||||
{/* ========== 애니메이션 블러 효과 ========== */}
|
||||
{/* 부드럽게 깜빡이는 원형 블러로 생동감 표현 */}
|
||||
{/* animate-pulse: 1.5초 주기로 opacity 변화 */}
|
||||
<div className="absolute left-1/4 top-1/4 h-64 w-64 animate-pulse rounded-full bg-indigo-400/30 blur-3xl dark:bg-indigo-600/20" />
|
||||
{/* delay-700: 700ms 지연으로 교차 애니메이션 효과 */}
|
||||
<div className="absolute bottom-1/4 right-1/4 h-64 w-64 animate-pulse rounded-full bg-purple-400/30 blur-3xl delay-700 dark:bg-purple-600/20" />
|
||||
|
||||
{/* ========== 메인 콘텐츠 영역 ========== */}
|
||||
{/* z-10: 배경보다 위에 표시 */}
|
||||
{/* animate-in: 페이지 로드 시 fade-in + slide-up 애니메이션 */}
|
||||
<div className="relative z-10 w-full max-w-md animate-in fade-in slide-in-from-bottom-4 duration-700">
|
||||
{/* 에러/성공 메시지 표시 영역 */}
|
||||
{/* URL 파라미터에 message가 있으면 표시됨 */}
|
||||
<FormMessage message={message} />
|
||||
|
||||
{/* ========== 로그인 카드 (Glassmorphism) ========== */}
|
||||
{/* bg-white/70: 70% 투명도의 흰색 배경 */}
|
||||
{/* backdrop-blur-xl: 배경 블러 효과 (유리 느낌) */}
|
||||
<Card className="border-white/20 bg-white/70 shadow-2xl backdrop-blur-xl dark:border-white/10 dark:bg-gray-900/70">
|
||||
{/* ========== 카드 헤더 영역 ========== */}
|
||||
<CardHeader className="space-y-3 text-center">
|
||||
{/* 아이콘 배경: 그라디언트 원형 */}
|
||||
<div className="mx-auto mb-2 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg">
|
||||
<span className="text-4xl">👋</span>
|
||||
</div>
|
||||
{/* 페이지 제목 */}
|
||||
<CardTitle className="text-3xl font-bold tracking-tight">
|
||||
환영합니다!
|
||||
</CardTitle>
|
||||
{/* 페이지 설명 */}
|
||||
<CardDescription className="text-base">
|
||||
서비스 이용을 위해 로그인해 주세요.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
{/* ========== 카드 콘텐츠 영역 (폼) ========== */}
|
||||
<CardContent className="space-y-6">
|
||||
{/* 로그인 폼 - formAction으로 서버 액션(login) 연결 */}
|
||||
<form className="space-y-5">
|
||||
{/* ========== 이메일 입력 필드 ========== */}
|
||||
<div className="space-y-2">
|
||||
{/* htmlFor와 Input의 id 연결로 접근성 향상 */}
|
||||
<Label htmlFor="email" className="text-sm font-medium">
|
||||
이메일
|
||||
</Label>
|
||||
{/* autoComplete="email": 브라우저 자동완성 기능 활성화 */}
|
||||
{/* required: HTML5 필수 입력 검증 */}
|
||||
<Input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
placeholder="your@email.com"
|
||||
autoComplete="email"
|
||||
required
|
||||
className="h-11 transition-all duration-200"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ========== 비밀번호 입력 필드 ========== */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="password" className="text-sm font-medium">
|
||||
비밀번호
|
||||
</Label>
|
||||
{/* pattern: 최소 8자, 대문자, 소문자, 숫자, 특수문자 각 1개 이상 */}
|
||||
{/* 참고: HTML pattern에서는 <, >, {, } 등 일부 특수문자 사용 시 브라우저 호환성 문제 발생 */}
|
||||
<Input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
placeholder="••••••••"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
minLength={8}
|
||||
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*]).{8,}$"
|
||||
title="비밀번호는 최소 8자 이상, 대문자, 소문자, 숫자, 특수문자를 각각 1개 이상 포함해야 합니다."
|
||||
className="h-11 transition-all duration-200"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 로그인 유지 & 비밀번호 찾기 */}
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center space-x-2">
|
||||
<Checkbox id="remember" name="remember-me" />
|
||||
<Label
|
||||
htmlFor="remember"
|
||||
className="cursor-pointer text-sm font-normal leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||
>
|
||||
로그인 유지
|
||||
</Label>
|
||||
</div>
|
||||
{/* 비밀번호 찾기 링크 */}
|
||||
<Link
|
||||
href="/forgot-password"
|
||||
className="text-sm font-medium text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-300"
|
||||
>
|
||||
비밀번호 찾기
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{/* 로그인 버튼 */}
|
||||
<Button
|
||||
formAction={login}
|
||||
type="submit"
|
||||
className="h-11 w-full bg-gradient-to-r from-indigo-600 to-purple-600 font-semibold shadow-lg transition-all duration-200 hover:from-indigo-700 hover:to-purple-700 hover:shadow-xl"
|
||||
size="lg"
|
||||
>
|
||||
로그인
|
||||
</Button>
|
||||
|
||||
{/* 회원가입 링크 */}
|
||||
<p className="text-center text-sm text-gray-600 dark:text-gray-400">
|
||||
계정이 없으신가요?{" "}
|
||||
<Link
|
||||
href="/signup"
|
||||
className="font-semibold text-indigo-600 transition-colors hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-300"
|
||||
>
|
||||
회원가입 하기
|
||||
</Link>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
{/* 소셜 로그인 구분선 */}
|
||||
<div className="relative">
|
||||
<Separator className="my-6" />
|
||||
<span className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 bg-white px-3 text-xs font-medium text-gray-500 dark:bg-gray-900 dark:text-gray-400">
|
||||
또는 소셜 로그인
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* 소셜 로그인 버튼들 */}
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="h-11 border-gray-200 bg-white shadow-sm transition-all duration-200 hover:bg-gray-50 hover:shadow-md dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-750"
|
||||
>
|
||||
<svg className="mr-2 h-5 w-5" viewBox="0 0 24 24">
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
||||
/>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
||||
/>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
||||
/>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
||||
/>
|
||||
</svg>
|
||||
Google
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="h-11 border-none bg-[#FEE500] font-semibold text-[#3C1E1E] shadow-sm transition-all duration-200 hover:bg-[#FDD835] hover:shadow-md"
|
||||
>
|
||||
<svg
|
||||
className="mr-2 h-5 w-5"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9-4.03-9-9-9zm-1.5 14.5h-3v-9h3v9zm3 0h-3v-5h3v5zm0-6h-3v-3h3v3z" />
|
||||
</svg>
|
||||
Kakao
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
114
app/page.tsx
Normal file
114
app/page.tsx
Normal file
@@ -0,0 +1,114 @@
|
||||
import Image from "next/image";
|
||||
import { signout } from "@/features/auth/actions";
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
/**
|
||||
* [메인 페이지 컴포넌트]
|
||||
*
|
||||
* 로그인한 사용자만 접근 가능 (Middleware에서 보호)
|
||||
* - 사용자 정보 표시 (이메일, 프로필 아바타)
|
||||
* - 로그아웃 버튼 제공
|
||||
*/
|
||||
export default async function Home() {
|
||||
// 현재 로그인한 사용자 정보 가져오기
|
||||
// Middleware에서 이미 인증을 확인했으므로 여기서는 user가 항상 존재함
|
||||
const supabase = await createClient();
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
|
||||
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
|
||||
{/* ========== 헤더: 로그인 정보 및 로그아웃 버튼 ========== */}
|
||||
<div className="flex w-full items-center justify-between">
|
||||
{/* 사용자 프로필 표시 */}
|
||||
<div className="flex items-center gap-3">
|
||||
{/* 프로필 아바타: 이메일 첫 글자 표시 */}
|
||||
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-gradient-to-br from-indigo-500 to-purple-600 text-white font-semibold">
|
||||
{user?.email?.charAt(0).toUpperCase() || "U"}
|
||||
</div>
|
||||
{/* 이메일 및 로그인 상태 텍스트 */}
|
||||
<div>
|
||||
<p className="text-sm font-medium text-gray-900 dark:text-white">
|
||||
{user?.email || "사용자"}
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
로그인됨
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/* 로그아웃 폼 */}
|
||||
{/* formAction: 서버 액션(signout)을 호출하여 로그아웃 처리 */}
|
||||
<form>
|
||||
<Button
|
||||
formAction={signout}
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="text-sm"
|
||||
>
|
||||
로그아웃
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js logo"
|
||||
width={100}
|
||||
height={20}
|
||||
priority
|
||||
/>
|
||||
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
|
||||
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
|
||||
To get started, edit the page.tsx file.
|
||||
</h1>
|
||||
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
|
||||
Looking for a starting point or more instructions? Head over to{" "}
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Templates
|
||||
</a>{" "}
|
||||
or the{" "}
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="font-medium text-zinc-950 dark:text-zinc-50"
|
||||
>
|
||||
Learning
|
||||
</a>{" "}
|
||||
center.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<Image
|
||||
className="dark:invert"
|
||||
src="/vercel.svg"
|
||||
alt="Vercel logomark"
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Deploy Now
|
||||
</a>
|
||||
<a
|
||||
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Documentation
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
145
app/reset-password/page.tsx
Normal file
145
app/reset-password/page.tsx
Normal file
@@ -0,0 +1,145 @@
|
||||
import FormMessage from "@/components/form-message";
|
||||
import { updatePassword } from "@/features/auth/actions";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
/**
|
||||
* [비밀번호 재설정 페이지]
|
||||
*
|
||||
* 이메일 링크를 통해 접근한 사용자만 새 비밀번호를 설정할 수 있습니다.
|
||||
* Supabase recovery 세션 검증으로 직접 URL 접근 차단
|
||||
*
|
||||
* PKCE 플로우:
|
||||
* 1. 사용자가 비밀번호 재설정 이메일의 링크 클릭
|
||||
* 2. Supabase가 토큰 검증 후 이 페이지로 ?code=xxx 파라미터와 함께 리다이렉트
|
||||
* 3. 이 페이지에서 code를 세션으로 교환
|
||||
* 4. 유효한 세션이 있으면 비밀번호 재설정 폼 표시
|
||||
*
|
||||
* @param searchParams - URL 쿼리 파라미터 (code: PKCE 코드, message: 에러/성공 메시지)
|
||||
*/
|
||||
export default async function ResetPasswordPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ message?: string; code?: string }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const supabase = await createClient();
|
||||
|
||||
// 1. 이메일 링크에서 code 파라미터 확인
|
||||
// Supabase는 이메일 링크를 통해 ?code=xxx 형태로 PKCE code를 전달합니다
|
||||
if (params.code) {
|
||||
// code를 세션으로 교환
|
||||
const { error } = await supabase.auth.exchangeCodeForSession(params.code);
|
||||
|
||||
if (error) {
|
||||
// code 교환 실패 (만료되었거나 유효하지 않음)
|
||||
console.error("Password reset code exchange error:", error.message);
|
||||
const message = encodeURIComponent(
|
||||
"비밀번호 재설정 링크가 만료되었거나 유효하지 않습니다.",
|
||||
);
|
||||
redirect(`/login?message=${message}`);
|
||||
}
|
||||
|
||||
// code 교환 성공 - code 없이 같은 페이지로 리다이렉트
|
||||
// (URL을 깨끗하게 유지하고 세션 쿠키가 설정된 상태로 리로드)
|
||||
redirect("/reset-password");
|
||||
}
|
||||
|
||||
// 2. 세션 확인
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
|
||||
// 3. 유효한 세션이 없으면 로그인 페이지로 리다이렉트
|
||||
if (!user) {
|
||||
const message = encodeURIComponent(
|
||||
"비밀번호 재설정 링크가 만료되었거나 유효하지 않습니다.",
|
||||
);
|
||||
redirect(`/login?message=${message}`);
|
||||
}
|
||||
|
||||
// URL에서 메시지 파라미터 추출
|
||||
const { message } = params;
|
||||
|
||||
return (
|
||||
<div className="relative flex min-h-screen items-center justify-center overflow-hidden bg-gradient-to-br from-indigo-50 via-purple-50 to-pink-50 px-4 py-12 dark:from-gray-950 dark:via-indigo-950 dark:to-purple-950">
|
||||
{/* ========== 배경 그라디언트 ========== */}
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-indigo-200/40 via-purple-200/20 to-transparent dark:from-indigo-900/30 dark:via-purple-900/20" />
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,_var(--tw-gradient-stops))] from-pink-200/40 via-purple-200/20 to-transparent dark:from-pink-900/30 dark:via-purple-900/20" />
|
||||
|
||||
{/* ========== 애니메이션 블러 효과 ========== */}
|
||||
<div className="absolute left-1/4 top-1/4 h-64 w-64 animate-pulse rounded-full bg-indigo-400/30 blur-3xl dark:bg-indigo-600/20" />
|
||||
<div className="absolute bottom-1/4 right-1/4 h-64 w-64 animate-pulse rounded-full bg-purple-400/30 blur-3xl delay-700 dark:bg-purple-600/20" />
|
||||
|
||||
{/* ========== 메인 콘텐츠 ========== */}
|
||||
<div className="relative z-10 w-full max-w-md animate-in fade-in slide-in-from-bottom-4 duration-700">
|
||||
{/* 에러/성공 메시지 */}
|
||||
{message && <FormMessage message={message} />}
|
||||
|
||||
{/* ========== 비밀번호 재설정 카드 ========== */}
|
||||
<Card className="border-white/20 bg-white/70 shadow-2xl backdrop-blur-xl dark:border-white/10 dark:bg-gray-900/70">
|
||||
<CardHeader className="space-y-3 text-center">
|
||||
{/* 아이콘 */}
|
||||
<div className="mx-auto mb-2 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg">
|
||||
<span className="text-4xl">🔐</span>
|
||||
</div>
|
||||
{/* 페이지 제목 */}
|
||||
<CardTitle className="text-3xl font-bold tracking-tight">
|
||||
비밀번호 재설정
|
||||
</CardTitle>
|
||||
{/* 페이지 설명 */}
|
||||
<CardDescription className="text-base">
|
||||
새로운 비밀번호를 입력해 주세요.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
{/* ========== 폼 영역 ========== */}
|
||||
<CardContent className="space-y-6">
|
||||
{/* 비밀번호 업데이트 폼 */}
|
||||
<form className="space-y-5">
|
||||
{/* ========== 새 비밀번호 입력 ========== */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="password" className="text-sm font-medium">
|
||||
새 비밀번호
|
||||
</Label>
|
||||
<Input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
placeholder="••••••••"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={8}
|
||||
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[!@#$%^&*]).{8,}$"
|
||||
title="비밀번호는 최소 8자 이상, 대문자, 소문자, 숫자, 특수문자를 각각 1개 이상 포함해야 합니다."
|
||||
className="h-11 transition-all duration-200"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
최소 8자 이상, 대문자, 소문자, 숫자, 특수문자 포함
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* ========== 비밀번호 변경 버튼 ========== */}
|
||||
<Button
|
||||
formAction={updatePassword}
|
||||
className="h-11 w-full bg-gradient-to-r from-indigo-600 to-purple-600 font-semibold text-white shadow-lg transition-all hover:from-indigo-700 hover:to-purple-700 hover:shadow-xl"
|
||||
>
|
||||
비밀번호 변경
|
||||
</Button>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
116
app/signup/page.tsx
Normal file
116
app/signup/page.tsx
Normal file
@@ -0,0 +1,116 @@
|
||||
import Link from "next/link";
|
||||
import { signup } from "@/features/auth/actions";
|
||||
import FormMessage from "@/components/form-message";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
|
||||
export default async function SignupPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ message: string }>;
|
||||
}) {
|
||||
const { message } = await searchParams;
|
||||
|
||||
return (
|
||||
<div className="relative flex min-h-screen items-center justify-center overflow-hidden bg-gradient-to-br from-indigo-50 via-purple-50 to-pink-50 px-4 py-12 dark:from-gray-950 dark:via-indigo-950 dark:to-purple-950">
|
||||
{/* 배경 그라데이션 효과 */}
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_top_right,_var(--tw-gradient-stops))] from-indigo-200/40 via-purple-200/20 to-transparent dark:from-indigo-900/30 dark:via-purple-900/20" />
|
||||
<div className="absolute inset-0 bg-[radial-gradient(ellipse_at_bottom_left,_var(--tw-gradient-stops))] from-pink-200/40 via-purple-200/20 to-transparent dark:from-pink-900/30 dark:via-purple-900/20" />
|
||||
|
||||
{/* 애니메이션 블러 효과 */}
|
||||
<div className="absolute left-1/4 top-1/4 h-64 w-64 animate-pulse rounded-full bg-indigo-400/30 blur-3xl dark:bg-indigo-600/20" />
|
||||
<div className="absolute bottom-1/4 right-1/4 h-64 w-64 animate-pulse rounded-full bg-purple-400/30 blur-3xl delay-700 dark:bg-purple-600/20" />
|
||||
|
||||
<div className="relative z-10 w-full max-w-md animate-in fade-in slide-in-from-bottom-4 duration-700">
|
||||
{/* 메시지 알림 */}
|
||||
<FormMessage message={message} />
|
||||
|
||||
<Card className="border-white/20 bg-white/70 shadow-2xl backdrop-blur-xl dark:border-white/10 dark:bg-gray-900/70">
|
||||
<CardHeader className="space-y-3 text-center">
|
||||
<div className="mx-auto mb-2 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-indigo-500 to-purple-600 shadow-lg">
|
||||
<span className="text-4xl">🚀</span>
|
||||
</div>
|
||||
<CardTitle className="text-3xl font-bold tracking-tight">
|
||||
회원가입
|
||||
</CardTitle>
|
||||
<CardDescription className="text-base">
|
||||
몇 가지 정보만 입력하면 바로 시작할 수 있습니다.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className="space-y-6">
|
||||
<form className="space-y-5">
|
||||
{/* 이메일 입력 */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="email" className="text-sm font-medium">
|
||||
이메일
|
||||
</Label>
|
||||
<Input
|
||||
id="email"
|
||||
name="email"
|
||||
type="email"
|
||||
placeholder="your@email.com"
|
||||
required
|
||||
className="h-11 transition-all duration-200"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 비밀번호 입력 */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="password" className="text-sm font-medium">
|
||||
비밀번호
|
||||
</Label>
|
||||
{/* pattern: 최소 8자, 대문자, 소문자, 숫자, 특수문자 각 1개 이상 */}
|
||||
{/* 참고: HTML pattern에서는 <, >, {, } 등 일부 특수문자 사용 시 브라우저 호환성 문제 발생 */}
|
||||
<Input
|
||||
id="password"
|
||||
name="password"
|
||||
type="password"
|
||||
placeholder="••••••••"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={6}
|
||||
pattern="^(?=.*[0-9])(?=.*[!@#$%^&*]).{6,}$"
|
||||
title="비밀번호는 최소 6자 이상, 숫자와 특수문자를 각각 1개 이상 포함해야 합니다."
|
||||
className="h-11 transition-all duration-200"
|
||||
/>
|
||||
<p className="text-xs text-gray-500 dark:text-gray-400">
|
||||
최소 6자 이상, 숫자, 특수문자 포함 (한글 가능)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 회원가입 버튼 */}
|
||||
<Button
|
||||
formAction={signup}
|
||||
type="submit"
|
||||
className="h-11 w-full bg-gradient-to-r from-indigo-600 to-purple-600 font-semibold shadow-lg transition-all duration-200 hover:from-indigo-700 hover:to-purple-700 hover:shadow-xl"
|
||||
size="lg"
|
||||
>
|
||||
회원가입 완료
|
||||
</Button>
|
||||
|
||||
{/* 로그인 링크 */}
|
||||
<p className="text-center text-sm text-gray-600 dark:text-gray-400">
|
||||
이미 계정이 있으신가요?{" "}
|
||||
<Link
|
||||
href="/login"
|
||||
className="font-semibold text-indigo-600 transition-colors hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-300"
|
||||
>
|
||||
로그인 하러 가기
|
||||
</Link>
|
||||
</p>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user