'use client' import Link from 'next/link' import { useState } from 'react' import PublicShell from '@/components/PublicShell' import { ADMIN_API_BASE } from '@/lib/api' export default function AdminForgotPasswordPage() { const [email, setEmail] = useState('') const [loading, setLoading] = useState(false) const [sent, setSent] = useState(false) const [error, setError] = useState(null) async function handleSubmit(e: React.FormEvent) { e.preventDefault() setLoading(true) setError(null) try { const res = await fetch(`${ADMIN_API_BASE}/admin/auth/forgot-password`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, credentials: 'include', body: JSON.stringify({ email }), }) if (!res.ok) throw new Error() setSent(true) } catch { setError('Something went wrong. Please try again.') } finally { setLoading(false) } } return (
RentalDriveGo

Forgot password

Enter your admin email to receive a reset link.

{sent ? (

Check your email

If that email is registered, a reset link has been sent. It expires in 60 minutes.

) : (
{error && (
{error}
)}
setEmail(e.target.value)} placeholder="admin@rentaldrivego.com" className="w-full rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm text-stone-900 placeholder:text-stone-400 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-orange-500 dark:border-blue-800 dark:bg-[#07101e]/80 dark:text-stone-100 dark:placeholder:text-stone-500" />
)}
Back to sign in
) }