1import{u as p,a as j,j as e}from"./index-CZ5-Dv-Y.js";import{b as P,r,L as v}from"./vendor-react-2siTqcnv.js";import{s as N}from"./AuthContext-Cm_WKt1x.js";import{P as m,v as k}from"./PasswordInput-CHOFcaJH.js";function L(){const{t:s}=p();j(s("resetPassword.pageTitle"));const u=P(),[a,x]=r.useState(""),[d,b]=r.useState(""),[l,t]=r.useState(null),[n,i]=r.useState(!1),[h,w]=r.useState(!1),g=async f=>{f.preventDefault(),t(null);const c=k(a);if(c){t(c);return}if(a!==d){t(s("resetPassword.passwordMismatch"));return}i(!0);try{const{error:o}=await N.auth.updateUser({password:a});o?o.message.includes("same password")?t(s("resetPassword.samePassword")):t(o.message):(w(!0),setTimeout(()=>u("/dashboard"),2e3))}catch{t(s("common.genericError"))}finally{i(!1)}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-surface px-4",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/tilby-icon.svg",alt:"Tilby",className:"w-10 h-10"}),e.jsx("span",{className:"text-3xl font-extrabold text-slate-800 dark:text-white",children:"tilby"})]}),e.jsx("p",{className:"text-slate-400 mt-1",children:s("resetPassword.subtitle")})]}),h?e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl shadow-sm border border-slate-100 dark:border-slate-700 p-6 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-green-50 dark:bg-green-900/30",children:e.jsx("svg",{width:"28",height:"28",fill:"none",viewBox:"0 0 24 24",className:"text-green-600",children:e.jsx("path",{stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"})})}),e.jsx("h2",{className:"text-lg font-bold text-slate-800 dark:text-slate-100 mb-2",children:s("resetPassword.successTitle")}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:s("resetPassword.redirecting")})]}):e.jsxs("form",{onSubmit:g,className:"bg-white dark:bg-slate-800 rounded-2xl shadow-sm border border-slate-100 dark:border-slate-700 p-6 space-y-4",children:[l&&e.jsx("div",{className:"bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 text-sm px-4 py-3 rounded-xl",children:l}),e.jsx(m,{id:"password",label:s("resetPassword.newPassword"),value:a,onChange:x,showStrength:!0}),e.jsx(m,{id:"confirmPassword",label:s("resetPassword.confirmNewPassword"),value:d,onChange:b,placeholder:s("auth.confirmPasswordPlaceholder")}),e.jsx("button",{type:"submit",disabled:n,className:"w-full bg-blue-600 hover:bg-blue-700 active:bg-blue-800 text-white font-bold py-3 rounded-xl shadow-sm transition-all disabled:opacity-50 disabled:cursor-not-allowed text-sm",children:s(n?"common.saving":"resetPassword.updatePassword")}),e.jsx("p",{className:"text-center text-sm text-slate-400",children:e.jsx(v,{to:"/login",className:"text-blue-600 hover:text-blue-700 font-semibold",children:s("resetPassword.backToLogin")})})]})]})})}export{L 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.