--- export const prerender = false; import { isAuthenticated, setPassword, ADMIN_COOKIE } from '@admin/lib/admin-auth'; interface Env { DB: D1Database } const runtime = Astro.locals.runtime as { env: Env } | undefined; const db = runtime?.env?.DB; if (!db || !await isAuthenticated(Astro.cookies.get(ADMIN_COOKIE)?.value, db)) { return Astro.redirect('/admin/login', 302); } let success = false; let error: string | null = null; if (Astro.request.method === 'POST') { const form = await Astro.request.formData(); const newPassword = form.get('new_password') as string; const confirm = form.get('confirm_password') as string; if (!newPassword || newPassword.length < 8) { error = 'Password must be at least 8 characters.'; } else if (newPassword !== confirm) { error = 'Passwords do not match.'; } else { await setPassword(newPassword, db); success = true; } } --- CultRoll Admin — Change Password

Minimum 8 characters.

{success &&
✓ Password updated successfully. Your next login will require the new password.
} {error &&
✗ {error}
}