PageSourceSearch

https://kc8nax21sn3wva8x0geds0zz.macaly.app/assets/setup-D1aEcJ-m.js

js kc8nax21sn3wva8x0geds0zz.macaly.app collected 2026-10-03 04:59:23 UTC 6,363 bytes, 1 lines download raw bytes

1import{k as e,r as d,L as b,u as y,g as x,n as g}from"./index-DRU7g3XG.js";import{A as p,U as j,a as N,u as f}from"./index-BvNRd1Ai.js";function S(){return e.jsxs(e.Fragment,{children:[e.jsx(p,{children:e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsx("div",{className:"text-gray-500 text-sm",children:"Loading…"})})}),e.jsx(j,{children:e.jsx(w,{})}),e.jsx(N,{children:e.jsx(v,{})})]})}function w(){const{signIn:o}=f(),[c,i]=d.useState("form"),[a,t]=d.useState(null),[n,r]=d.useState(!1);return typeof c=="object"?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"text-3xl mb-2",children:"📧"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Verify your email"}),e.jsxs("p",{className:"text-gray-500 text-sm mt-1",children:["Enter the 6-digit code sent to ",e.jsx("strong",{children:c.email})]})]}),e.jsxs("form",{onSubmit:async s=>{s.preventDefault(),t(null),r(!0);const l=new FormData(s.currentTarget);try{await o("resend-otp",l)}catch{t("Invalid or expired code.")}finally{r(!1)}},className:"space-y-4",children:[e.jsx("input",{type:"hidden",name:"email",value:c.email}),e.jsx("input",{name:"code",type:"text",inputMode:"numeric",pattern:"\\d{6}",required:!0,placeholder:"000000",className:"w-full border border-gray-300 rounded-xl px-4 py-3 text-center text-2xl tracking-widest focus:outline-none focus:ring-2 focus:ring-blue-500"}),a&&e.jsx("p",{className:"text-red-600 text-sm text-center",children:a}),e.jsx("button",{type:"submit",disabled:n,className:"w-full bg-blue-600 text-white rounded-xl py-3 font-semibold hover:bg-blue-700 disabled:opacity-50",children:n?"Verifying…":"Verify Email"})]})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"text-4xl mb-3",children:"🔐"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Create Admin Account"}),e.jsx("p",{className:"text-gray-500 text-sm mt-1",children:"One-time setup — this creates your admin login"})]}),e.jsxs("form",{onSubmit:async s=>{s.preventDefault(),t(null),r(!0);const l=new FormData(s.currentTarget),u=l.get("email");try{await o("password",l),i({email:u})}catch(h){const m=h instanceof Error?h.message:"";m.toLowerCase().includes("authorised")||m.toLowerCase().includes("authorized")?t("This email address is not authorised. Only invited admins can create accounts."):m.includes("already exists")?t("Account already exists. Go to /admin to sign in."):t("Could not create account. Password must be 8+ characters.")}finally{r(!1)}},className:"space-y-4",children:[e.jsx("input",{type:"hidden",name:"flow",value:"signUp"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email address"}),e.jsx("input",{name:"email",type:"email",required:!0,placeholder:"[email protected]",className:"w-full border border-gray-300 rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Password (8+ characters)"}),e.jsx("input",{name:"password",type:"password",required:!0,minLength:8,placeholder:"••••••••",className:"w-full border border-gray-300 rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),a&&e.jsx("p",{className:"text-red-600 text-sm",children:a}),e.jsx("button",{type:"submit",disabled:n,className:"w-full bg-blue-600 text-white rounded-xl py-3 font-semibold hover:bg-blue-700 disabled:opacity-50",children:n?"Creating account…":"Create Admin Account"})]}),e.jsxs("p",{className:"text-center text-sm text-gray-400 mt-4",children:["Already have an account?"," ",e.jsx(b,{to:"/admin",className:"text-blue-600 hover:underline",children:"Sign in"})]})]})})}function v(){const{signOut:o}=f(),c=y(x.pricing.makeAdmin),i=g(x.authz.currentUser),a=g(x.authz.isAdmin),[t,n]=d.use
1State(!1),[r,s]=d.useState(null);if(i===void 0||a===void 0)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsx("p",{className:"text-gray-500 text-sm",children:"Loading…"})});if(a)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 w-full max-w-md text-center",children:[e.jsx("div",{className:"text-4xl mb-3",children:"✅"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"You're already an admin!"}),e.jsx(b,{to:"/admin",className:"inline-block mt-4 bg-blue-600 text-white px-6 py-3 rounded-xl font-semibold hover:bg-blue-700",children:"Go to Admin Panel"})]})});const l=async()=>{if(!i?.email)return;n(!0),s(null),(await c({email:i.email})).ok||s("Could not grant admin access. An admin already exists — ask them to promote you from the admin panel."),n(!1)};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-lg p-8 w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"text-4xl mb-3",children:"🛡️"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Activate Admin Access"}),e.jsxs("p",{className:"text-gray-500 text-sm mt-1",children:["Logged in as ",e.jsx("strong",{children:i?.email})]})]}),e.jsx("p",{className:"text-sm text-gray-600 mb-6 text-center",children:"Click below to grant yourself admin privileges. This only works if no admins exist yet."}),r&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4 mb-4 text-sm text-red-700",children:r}),e.jsx("button",{onClick:l,disabled:t,className:"w-full bg-blue-600 text-white rounded-xl py-3 font-semibold hover:bg-blue-700 disabled:opacity-50",children:t?"Activating…":"Activate Admin Access"}),e.jsx("button",{onClick:()=>o(),className:"w-full mt-3 text-sm text-gray-500 hover:text-gray-700",children:"Sign out"})]})})}export{S as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.