import Link from 'next/link'; import { redirect } from 'next/navigation'; import { isAdminAuthenticated } from '@/lib/adminAuth'; import { changeAdminPassword } from './actions'; const ERROR_MESSAGES: Record = { missing_fields: 'Please fill in all fields.', password_too_short: 'Password must be at least 8 characters.', passwords_dont_match: 'Passwords do not match.', invalid_current: 'Current password is incorrect.', }; export default async function ChangeAdminPasswordPage({ searchParams }: { searchParams: { error?: string } }) { const isAuthenticated = await isAdminAuthenticated(); if (!isAuthenticated) redirect('/admin/login'); const error = searchParams.error ? ERROR_MESSAGES[searchParams.error] : null; return (
← Back to orders

Change admin password

Update your admin account password

{error && (

{error}

)}

At least 8 characters

); }