chore: remove next-auth, use simple auth
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { signIn } from 'next-auth/react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import Image from 'next/image'
|
||||
|
||||
export default function AdminLoginPage() {
|
||||
const router = useRouter()
|
||||
const [email, setEmail] = useState('')
|
||||
const [password, setPassword] = useState('')
|
||||
const [error, setError] = useState('')
|
||||
const [loading, setLoading] = useState(false)
|
||||
@@ -17,17 +15,14 @@ export default function AdminLoginPage() {
|
||||
setLoading(true)
|
||||
setError('')
|
||||
|
||||
const result = await signIn('credentials', {
|
||||
email,
|
||||
password,
|
||||
redirect: false,
|
||||
})
|
||||
|
||||
if (result?.error) {
|
||||
setError('Email veya şifre hatalı.')
|
||||
setLoading(false)
|
||||
} else {
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,16 +41,6 @@ export default function AdminLoginPage() {
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSubmit} className="bg-white/5 border border-white/10 rounded-2xl p-8 space-y-4">
|
||||
<div>
|
||||
<input
|
||||
type="email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
placeholder="Email"
|
||||
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>
|
||||
<div>
|
||||
<input
|
||||
type="password"
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
import { handlers } from '@/lib/auth'
|
||||
export const { GET, POST } = handlers
|
||||
import { NextResponse } from 'next/server'
|
||||
|
||||
// NextAuth kaldırıldı
|
||||
export async function GET() {
|
||||
return NextResponse.json({ error: 'Not found' }, { status: 404 })
|
||||
}
|
||||
export async function POST() {
|
||||
return NextResponse.json({ error: 'Not found' }, { status: 404 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user