import { a as isValidLogin, s as setAdminSession } from '../../../chunks/adminAuth_CY4OwU1a.mjs';
export { renderers } from '../../../renderers.mjs';

const POST = async (context) => {
  const formData = await context.request.formData();
  const username = String(formData.get("username") ?? "");
  const password = String(formData.get("password") ?? "");
  if (!isValidLogin(username, password)) {
    return context.redirect("/admin/login/?error=1", 302);
  }
  setAdminSession(context);
  return context.redirect("/admin/", 302);
};

const _page = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
  __proto__: null,
  POST
}, Symbol.toStringTag, { value: 'Module' }));

const page = () => _page;

export { page };
