PageSourceSearch

https://app.repairsnap.ai/assets/reset-password-confirm-0y_i758v.js

js repairsnap.ai collected 2026-10-05 14:20:59 UTC 3,483 bytes, 1 lines download raw bytes

1import{a as N,t as k,r as o,F as S,j as e,P as w,B as u,L as m,I as g}from"./index-BTqgdxf7.js";function R(){const x=N(),[f]=k(),i=f.get("token")||"",[t,b]=o.useState(""),[l,v]=o.useState(""),[d,P]=o.useState(!1),[j,p]=o.useState(!1),[a,r]=o.useState({}),h=o.useCallback(()=>{const s={};return t?t.length<8?s.password="Password must be at least 8 characters":t.length>128&&(s.password="Password must be at most 128 characters"):s.password="Password is required",l?t!==l&&(s.confirm="Passwords do not match"):s.confirm="Please confirm your password",r(s),Object.keys(s).length===0},[t,l]),y=o.useCallback(async s=>{if(s.preventDefault(),!i){r({general:"Invalid or missing reset token. Please request a new reset link."});return}if(h()){p(!0),r({});try{await S(i,t),x("/app/login?reset=success",{replace:!0})}catch(n){const c=n;c.status===400?r({general:"This reset link has expired or has already been used. Please request a new one."}):c.status===429?r({general:"Too many attempts. Please try again later."}):r({general:c.message||"Something went wrong. Please try again."})}finally{p(!1)}}},[i,t,h,x]);return i?e.jsx(w,{children:e.jsxs("div",{className:"max-w-md mx-auto px-4 py-12",children:[e.jsx("h1",{className:"text-3xl font-bold mb-2 text-foreground",children:"Set New Password"}),e.jsx("p",{className:"text-muted mb-8",children:"Enter your new password below."}),a.general&&e.jsxs("div",{className:"mb-6 rounded-lg border border-destructive/30 bg-destructive-bg px-4 py-3 text-sm text-destructive-text",children:[a.general,a.general.includes("expired")&&e.jsx(m,{to:"/app/reset-password",className:"block mt-2 text-primary-text hover:underline",children:"Request a new reset link"})]}),e.jsxs("form",{onSubmit:y,noValidate:!0,className:"space-y-5",children:[e.jsx("div",{children:e.jsx(g,{id:"password",type:d?"text":"password",autoComplete:"new-password",required:!0,label:"New Password",value:t,onChange:s=>{b(s.target.value),a.password&&r(n=>({...n,password:void 0}))},error:a.password,placeholder:"Min. 8 characters",className:"bg-surface",endAdornment:e.jsx(u,{type:"button",variant:"ghost",size:"sm",onClick:()=>P(s=>!s),className:"text-subtle hover:text-muted text-sm h-auto p-0",tabIndex:-1,children:d?"Hide":"Show"})})}),e.jsx(g,{id:"confirmPassword",type:d?"text":"password",autoComplete:"new-password",required:!0,label:"Confirm Password",value:l,onChange:s=>{v(s.target.value),a.confirm&&r(n=>({...n,confirm:void 0}))},error:a.confirm,placeholder:"Re-enter your new password",className:"bg-surface"}),e.jsx(u,{type:"submit",loading:j,loadingText:"Resetting...",fullWidth:!0,size:"lg",children:"Reset Password"})]}),e.jsx("p",{className:"mt-6 text-center text-sm text-muted",children:e.jsx(m,{to:"/app/login",className:"text-primary-text hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded",children:"Back to login"})})]})}):e.jsx(w,{children:e.jsx("div",{className:"max-w-md mx-auto px-4 py-12",children:e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive-bg p-6 text-center",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:"Invalid Reset Link"}),e.jsx("p",{className:"text-muted text-sm mb-4",children:"This password reset link is invalid or has expired."}),e.jsx(u,{asChild:!0,children:e.jsx(m,{to:"/app/reset-password",children:"Request New Reset Link"})})]})})})}export{R 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.