1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{b as P,r as a}from"./vendor-react-E98sgxjj.js";import{u as N,c as y,H as L,L as i,e as k}from"./index-BKzE8EQ8.js";import{u as _}from"./useLocaleNavigate-BNriJdRU.js";import"./vendor-fa-Bn2dnpnC.js";import"./vendor-query-bOUN_gKe.js";function F(){const{t:s}=N("auth"),{uid:l,token:c}=P(),p=_(),{isLight:g}=y(),[n,f]=a.useState(""),[d,w]=a.useState(""),[u,m]=a.useState(!1),[x,r]=a.useState(""),[b,h]=a.useState(!1),j=async o=>{if(o.preventDefault(),r(""),n!==d){r(s("resetPassword.passwordsDoNotMatch"));return}if(n.length<8){r(s("resetPassword.passwordMinLength"));return}if(!l||!c){r(s("resetPassword.invalidResetLink"));return}m(!0);try{await k.resetPassword({uid:l,token:c,new_password1:n,new_password2:d}),h(!0),setTimeout(()=>p("/login"),3e3)}catch(v){const t=v.response?.data;t?.new_password2?r(t.new_password2[0]):t?.new_password1?r(t.new_password1[0]):t?.token?r(s("resetPassword.expiredResetLink")):t?.uid?r(s("resetPassword.invalidResetLink")):r(t?.detail||s("resetPassword.errorDefault"))}finally{m(!1)}};return e.jsxs("div",{className:"min-h-screen flex items-center justify-center p-6 bg-background relative",children:[e.jsxs(L,{children:[e.jsx("title",{children:s("resetPassword.pageTitle")}),e.jsx("meta",{name:"description",content:s("resetPassword.metaDescription")})]}),e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,rgba(255,115,58,0.08)_0%,transparent_50%)] pointer-events-none"}),e.jsxs("div",{className:"w-full max-w-md relative z-10",children:[e.jsx(i,{to:"/",className:"flex justify-center mb-10",children:e.jsx("img",{src:"/logos/tessala-logo.svg",alt:"Tesana",className:`object-contain object-left w-[106px] h-[28px] transition-all ${g?"invert":"invert-0"}`})}),e.jsx("div",{className:"bg-card border border-border rounded-md p-8",children:b?e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-6 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),e.jsx("h1",{className:"text-2xl text-foreground mb-2",children:s("resetPassword.successTitle")}),e.jsx("p",{className:"text-muted-foreground mb-6",children:s("resetPassword.successDescription")}),e.jsx(i,{to:"/login",className:"inline-block px-6 py-3 bg-accent text-accent-foreground rounded-lg hover:opacity-90 transition-opacity",children:s("resetPassword.goToLogin")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-2xl text-foreground mb-2",children:s("resetPassword.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("resetPassword.subtitle")})]}),x&&e.jsx("div",{className:"mb-6 p-4 bg-destructive/10 border border-destructive/30 rounded-lg text-destructive text-sm",children:x}),e.jsxs("form",{onSubmit:j,className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-foreground mb-2",children:s("resetPassword.newPasswordLabel")}),e.jsx("input",{type:"password",className:"w-full px-4 py-3 bg-input border border-border rounded-lg text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-accent transition-colors",value:n,onChange:o=>f(o.target.value),placeholder:s("resetPassword.newPasswordPlaceholder"),required:!0,autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-foreground mb-2",children:s("resetPassword.confirmPasswordLabel")}),e.jsx("input",{type:"password",className:"w-full px-4 py-3 bg-input border border-border rounded-lg text-foreground placeholder:text-muted-foreground focus:outline-none focus:border-accent transition-colors",value:d,onChange:o=>w(o.target.value),placeholder:s("resetPassword.confirmPasswordPlaceholder"),required:!0})]}),e.jsx("button",{type:"submit",disabled:u,className:"w-full py-3 bg-accent text-accent-foreground rounded-lg hover:opacity-90 transition-opacity disabled:opacity-50 flex items-center justify-center gap-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-accent-foreground border-t-transparent roun
1ded-full animate-spin"}),s("resetPassword.submitting")]}):s("resetPassword.submit")})]}),e.jsx("div",{className:"mt-6 text-center",children:e.jsx(i,{to:"/login",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:s("resetPassword.backToLogin")})})]})})]})]})}export{F 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.