Files
marmarislocal/app/[locale]/login/page.tsx
T
AyrisAIandClaude Sonnet 5 1b8cfeda95 feat: harden admin security, add AI trip planner, map view, and SEO/notification improvements
Security:
- requireAdmin() session check added to every admin-only server action
  (previously relied only on middleware path matching, which Next.js
  Server Actions don't reliably respect)
- Real Prisma + bcrypt admin auth, replacing hardcoded credentials; split
  into an Edge-safe auth.config.ts (used by proxy.ts) and the full
  Prisma-backed auth.ts (route handler, server actions, server components)
- Removed hardcoded fallback secret on the Instagram sync cron endpoint
- Honeypot field + per-IP rate limiting on contact/business-submission
  forms and the analytics events endpoint

Features:
- AI trip planner (/plan-olustur, /plan/[id]) backed by DeepSeek, grounded
  to only recommend isLocalApproved listings, with a deterministic
  link-injection fallback for anything the model doesn't format as markdown
- Interactive Leaflet/OpenStreetMap view on category listing pages
- Telegram notifications for new contact messages and business submissions

SEO:
- Brand-consistent favicon/apple-icon/PWA icons and default Open Graph/
  Twitter share images, generated via next/og (replacing default Next.js
  placeholders)
- BreadcrumbList structured data on category and listing detail pages
- Fixed two remaining raw <img> tags to use next/image

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-24 00:01:06 +03:00

100 lines
3.9 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 { signIn } from 'next-auth/react'
import { useRouter } from 'next/navigation'
export default function LoginPage() {
const router = useRouter()
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [error, setError] = useState('')
const [loading, setLoading] = useState(false)
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
setLoading(true)
setError('')
const result = await signIn('credentials', {
redirect: false,
email,
password,
})
if (result?.error) {
setError('Geçersiz e-posta veya şifre')
setLoading(false)
} else {
router.push('/admin')
router.refresh()
}
}
return (
<div className="min-h-[100dvh] flex items-center justify-center bg-pine px-4 py-12">
<div className="w-full max-w-md bg-paper rounded-3xl shadow-xl border border-white/10 overflow-hidden">
<div className="p-8 sm:p-10 space-y-6">
{/* Logo & Brand Header */}
<div className="text-center space-y-3">
<div className="inline-flex items-center justify-center w-12 h-12 rounded-full border-2 border-stone bg-paper shadow-sm">
<span className="font-heading font-extrabold text-pine text-sm tracking-tighter">ML</span>
</div>
<h1 className="text-2xl font-heading font-extrabold text-pine tracking-tight lowercase">
marmaris <span className="text-turquoise">local</span>
</h1>
<p className="text-xs text-stone-deep font-mono uppercase tracking-wider">
backoffice admin login
</p>
</div>
{error && (
<div className="bg-bougainvillea/10 text-bougainvillea p-3.5 rounded-xl text-xs font-mono border border-bougainvillea/20 text-center font-semibold">
{error}
</div>
)}
<form onSubmit={handleSubmit} className="space-y-4">
<div>
<label className="block text-xs font-mono font-bold text-pine/80 uppercase tracking-wider mb-1.5" htmlFor="email">
E-posta Adresi
</label>
<input
id="email"
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
required
className="w-full px-4 py-3 border border-pine/15 rounded-xl focus:ring-2 focus:ring-turquoise focus:border-turquoise bg-stone/20 text-pine text-sm transition-colors outline-none font-medium min-h-[44px]"
placeholder="admin@ayris.tech"
/>
</div>
<div>
<label className="block text-xs font-mono font-bold text-pine/80 uppercase tracking-wider mb-1.5" htmlFor="password">
Şifre
</label>
<input
id="password"
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
required
className="w-full px-4 py-3 border border-pine/15 rounded-xl focus:ring-2 focus:ring-turquoise focus:border-turquoise bg-stone/20 text-pine text-sm transition-colors outline-none font-medium min-h-[44px]"
placeholder="••••••••"
/>
</div>
<button
type="submit"
disabled={loading}
className="w-full bg-turquoise hover:bg-turquoise/90 text-paper font-bold py-3.5 px-4 rounded-xl transition-all duration-150 active:scale-95 shadow-sm disabled:opacity-70 disabled:cursor-not-allowed cursor-pointer min-h-[44px] text-xs font-mono uppercase tracking-wider mt-2"
>
{loading ? 'Giriş yapılıyor...' : 'Giriş Yap'}
</button>
</form>
</div>
</div>
</div>
)
}