"use client" import type React from "react" import { useState } from "react" import { useAuth } from "@/contexts/auth-context" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { Alert, AlertDescription } from "@/components/ui/alert" import { Eye, EyeOff, Mail, Lock } from "lucide-react" interface LoginDialogProps { open: boolean onOpenChange: (open: boolean) => void onSwitchToRegister: () => void onSwitchToForgotPassword: () => void } export function LoginDialog({ open, onOpenChange, onSwitchToRegister, onSwitchToForgotPassword }: LoginDialogProps) { const { login, isLoading } = useAuth() const [email, setEmail] = useState("") const [password, setPassword] = useState("") const [showPassword, setShowPassword] = useState(false) const [error, setError] = useState("") const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError("") if (!email || !password) { setError("請填寫所有欄位") return } const success = await login(email, password) if (success) { onOpenChange(false) setEmail("") setPassword("") } else { setError("登入失敗,請檢查您的電子郵件和密碼") } } return ( 登入帳號 歡迎回到強茂集團 AI 展示平台
setEmail(e.target.value)} className="pl-10" required />
setPassword(e.target.value)} className="pl-10 pr-10" required />
{error && ( {error} )}

測試帳號:

Email: zhang@panjit.com

Password: password123

還沒有帳號?
) }