This commit is contained in:
2025-02-27 11:21:06 -03:00
parent ad7f6edcc0
commit 24d107cc9d
2 changed files with 126 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
"use client"
import { useState } from "react"
import { useRouter } from "next/navigation"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { useAuth } from "@/contexts/auth-context"
export default function LoginPage() {
const [email, setEmail] = useState("")
const [password, setPassword] = useState("")
const router = useRouter()
const { login } = useAuth()
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault()
// In a real application, you would validate credentials here
login()
router.push("/")
}
return (
<div className="container mx-auto px-4 py-8">
<h1 className="text-2xl font-bold mb-6">Войти</h1>
<form onSubmit={handleSubmit} className="space-y-4 max-w-md mx-auto">
<div>
<Label htmlFor="email">Email</Label>
<Input type="email" id="email" value={email} onChange={(e) => setEmail(e.target.value)} required />
</div>
<div>
<Label htmlFor="password">Пароль</Label>
<Input
type="password"
id="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
/>
</div>
<Button type="submit" className="w-full">
Войти
</Button>
</form>
</div>
)
}