1import{b as g,r as t,k as n,j as e,H as j,L as u,I as m,B as b,i}from"./index-ReD1RTaB.js";const N=()=>{const p=g(),[r,h]=t.useState(""),[o,x]=t.useState(""),[d,l]=t.useState(!1),[w,c]=t.useState(!1);t.useEffect(()=>{const{data:{subscription:a}}=n.auth.onAuthStateChange(s=>{(s==="PASSWORD_RECOVERY"||s==="SIGNED_IN")&&c(!0)});return n.auth.getSession().then(({data:{session:s}})=>{s&&c(!0)}),()=>a.unsubscribe()},[]);const f=async a=>{if(a.preventDefault(),r!==o){i.error("Passwords do not match");return}l(!0);try{const{error:s}=await n.auth.updateUser({password:r});if(s)throw s;i.success("Password updated. Signing you in."),p("/admin",{replace:!0})}catch(s){i.error((s==null?void 0:s.message)??"Something went wrong")}finally{l(!1)}};return e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx("title",{children:"Reset Password | Hunter & Bard Admin"}),e.jsx("meta",{name:"robots",content:"noindex,nofollow"})]}),e.jsx("main",{className:"min-h-screen bg-white flex items-center justify-center px-6 py-16",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("header",{className:"mb-8",children:[e.jsx("p",{className:"font-semibold text-xs text-obsidian-900 uppercase tracking-wider mb-3",children:"Admin Access"}),e.jsx("h1",{className:"font-display text-4xl text-obsidian-900 uppercase font-semibold",children:"Set new password"})]}),w?e.jsxs("form",{onSubmit:f,className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"password",children:"New password"}),e.jsx(m,{id:"password",type:"password",value:r,onChange:a=>h(a.target.value),required:!0,minLength:8,autoComplete:"new-password"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"confirm",children:"Confirm password"}),e.jsx(m,{id:"confirm",type:"password",value:o,onChange:a=>x(a.target.value),required:!0,minLength:8,autoComplete:"new-password"})]}),e.jsx(b,{type:"submit",variant:"wasabi",size:"default",disabled:d,className:"w-full",children:d?"Working...":"Update password"})]}):e.jsx("p",{className:"text-sm text-mushroom-600",children:"Open this page from the password reset link in your email."})]})})]})};export{N as default};
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.