import{R as l,t as m,r as u,j as e,N as x}from"./index-B-YXshIJ.js";const h=()=>{const[t,d]=l.useState(""),[a,i]=l.useState(""),[o,n]=l.useState(""),s=m.auth.verifySession.useQuery().data,p=u.useCallback(async r=>{r.preventDefault();try{(await fetch("/api/update-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s==null?void 0:s.email,oldPassword:t,newPassword:a})})).status===200&&(window.location.href="/?auth=true")}catch(c){}},[s==null?void 0:s.email,t,a]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:"text-gray-900 text-2xl font-semibold",children:"Personal Settings"}),e.jsx("hr",{className:"my-2"}),e.jsx("p",{className:"mb-6",children:"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel obcaecati repudiandae illum quidem doloremque. Porro voluptas asperiores, tempora eos voluptatibus eveniet corrupti. Distinctio aliquam eligendi consequatur? Harum iste quam dolorem."}),e.jsxs("h3",{className:"text-gray-900 text-2xl font-semibold",children:["Update Password For"," ",e.jsx("span",{className:"text-purple-900 font-extrabold",children:s==null?void 0:s.email})]}),e.jsx("hr",{className:"my-2"}),e.jsxs("form",{onSubmit:p,children:[e.jsxs("div",{className:"pb-6 flex flex-col align-center justify-between",children:[e.jsx("label",{className:"pr-2 pb-2 text-gray-900 text-base font-semibold",htmlFor:"old-password",children:"Old Password"}),e.jsx("input",{className:"border border-gray-300 rounded-md px-3 py-3 placeholder-gray-400",id:"old-password",type:"password",value:t||"",onChange:r=>d(r.target.value),placeholder:"********",required:!0})]}),e.jsxs("div",{className:"pb-6 flex flex-col align-center justify-between",children:[e.jsx("label",{className:"pr-2 pb-2 text-gray-900 text-base font-semibold",htmlFor:"new-password",children:"New Password"}),e.jsx("input",{className:"border border-gray-300 rounded-md px-3 py-3 placeholder-gray-400",id:"new-password",type:"password",value:a||"",onChange:r=>i(r.target.value),placeholder:"********",required:!0})]}),e.jsxs("div",{className:"pb-6 flex flex-col align-center justify-between",children:[e.jsx("label",{className:"pr-2 pb-2 text-gray-900 text-base font-semibold",htmlFor:"confirm-password",children:"Confirm Password"}),e.jsx("input",{className:"border border-gray-300 rounded-md px-3 py-3 placeholder-gray-400",id:"confirm-password",type:"password",value:o||"",onChange:r=>n(r.target.value),placeholder:"********",required:!0})]}),e.jsx("button",{type:"submit",className:x(t===""||a===""||o===""||a!==o?"bg-slate-300 px-5 py-3 text-stone-700 cursor-not-allowed":"bg-gradient-to-r from-purple-950 to-purple-800 text-white cursor-pointer","px-5 py-3 rounded-md w-full text-base font-semibold"),disabled:t===""||a===""||o===""||a!==o,children:"Update Password"})]})]})};export{h as default};
