"use client" import type React from "react" import { useState } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Alert, AlertDescription } from "@/components/ui/alert" import { Users, Eye, EyeOff } from "lucide-react" import Link from "next/link" import { useRouter } from "next/navigation" import { useAuth } from "@/lib/hooks/use-auth" export default function LoginPage() { const [email, setEmail] = useState("") const [password, setPassword] = useState("") const [showPassword, setShowPassword] = useState(false) const [error, setError] = useState("") const [isLoading, setIsLoading] = useState(false) const router = useRouter() const { login } = useAuth() const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError("") setIsLoading(true) try { const success = await login(email, password) if (success) { router.push("/dashboard") } else { setError("帳號或密碼錯誤") } } catch (err) { setError("登入失敗,請稍後再試") } finally { setIsLoading(false) } } return (
請登入您的帳戶
還沒有帳戶?{" "} 立即註冊
測試帳戶:
管理者:admin@company.com / admin123
員工:user@company.com / user123