Files
vesta/app/[locale]/admin/login/page.tsx
T

67 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client'
import { useState } from 'react'
import { useRouter } from 'next/navigation'
import Image from 'next/image'
export default function AdminLoginPage() {
const router = useRouter()
const [password, setPassword] = useState('')
const [error, setError] = useState('')
const [loading, setLoading] = useState(false)
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
setLoading(true)
setError('')
// Basit şifre kontrolü — ileride API'ye bağlanabilir
const adminPass = process.env.NEXT_PUBLIC_ADMIN_PASSWORD || 'vesta2025'
if (password === adminPass) {
sessionStorage.setItem('admin_auth', '1')
router.push('/tr/admin')
} else {
setError('Şifre hatalı.')
setLoading(false)
}
}
return (
<div className="min-h-screen bg-vesta-dark flex items-center justify-center px-4">
<div className="w-full max-w-sm">
<div className="text-center mb-8">
<Image
src="https://cdn.prod.website-files.com/6693a42300f08d15d3514511/6694e59f468a02af6267826d_H%20FULL%20LOGO%20-%20WHITE.png"
alt="Vesta Muğla"
width={160}
height={40}
className="h-8 w-auto object-contain mx-auto mb-2"
/>
<p className="text-white/40 text-sm">Admin Paneli</p>
</div>
<form onSubmit={handleSubmit} className="bg-white/5 border border-white/10 rounded-2xl p-8 space-y-4">
<div>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
placeholder="Şifre"
required
className="w-full bg-white/10 border border-white/10 rounded-xl px-4 py-3 text-white placeholder:text-white/30 focus:outline-none focus:ring-2 focus:ring-vesta-earth/50"
/>
</div>
{error && <p className="text-red-400 text-sm">{error}</p>}
<button
type="submit"
disabled={loading}
className="w-full bg-vesta-earth text-white py-3 rounded-xl text-sm font-medium hover:bg-vesta-earth/80 transition-colors disabled:opacity-50"
>
{loading ? 'Giriş yapılıyor...' : 'Giriş Yap'}
</button>
</form>
</div>
</div>
)
}