PageSourceSearch

https://snapio.ai/assets/reset-password-B6ZM5x7u.js

js snapio.ai collected 2026-10-05 14:41:22 UTC 5,284 bytes, 1 lines download raw bytes

1import{r as l,u as q,F as O,bs as U,j as s,C as h,f as x,b2 as D,aq as u,as as w,e as N,dq as f,a8 as i,B as n,b7 as Y,bt as A,bu as v,bv as y,bw as C,bx as P,v as S,bi as k,ac as F,bz as E,bC as H,bD as p}from"./index-BSiIgY1-.js";const J=p.object({password:p.string().min(6,"Password must be at least 6 characters"),confirmPassword:p.string()}).refine(e=>e.password===e.confirmPassword,{message:"Passwords don't match",path:["confirmPassword"]});function V(){const[e,j]=l.useState(!1),[L,T]=l.useState(!1),[c,I]=l.useState(!1),[d,R]=l.useState(!1),[m,B]=l.useState(null),[,b]=q(),{toast:r}=O(),o=U({resolver:H(J),defaultValues:{password:"",confirmPassword:""}});l.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("token");a?B(a):(r({title:"Invalid reset link",description:"This password reset link is invalid or expired.",variant:"destructive"}),b("/forgot-password"))},[r,b]);const z=async t=>{if(!m){r({title:"Error",description:"Invalid reset token",variant:"destructive"});return}try{j(!0);const a=await fetch("/api/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:m,password:t.password})}),g=await a.json();a.ok?(T(!0),r({title:"Password reset successful",description:g.message})):r({title:"Reset failed",description:g.message||"Failed to reset password",variant:"destructive"})}catch(a){r({title:"Error",description:a.message||"Something went wrong",variant:"destructive"})}finally{j(!1)}};return L?s.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gradient-to-br from-green-50 to-emerald-100 p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs(h,{className:"w-full shadow-xl border-0",children:[s.jsxs(x,{className:"space-y-1 text-center",children:[s.jsx("div",{className:"mx-auto w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(D,{className:"w-6 h-6 text-green-600"})}),s.jsx(u,{className:"text-2xl font-bold text-green-700",children:"Password Reset Complete"}),s.jsx(w,{children:"Your password has been successfully updated"})]}),s.jsx(N,{className:"space-y-4",children:s.jsx("div",{className:"text-center text-sm text-muted-foreground",children:s.jsx("p",{children:"You can now sign in with your new password."})})}),s.jsx(f,{children:s.jsx(i,{href:"/auth",className:"w-full",children:s.jsx(n,{className:"w-full h-11",children:"Sign in to your account"})})})]})})}):m?s.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs(h,{className:"w-full shadow-xl border-0",children:[s.jsxs(x,{className:"space-y-1 text-center",children:[s.jsx(u,{className:"text-2xl font-bold",children:"Set new password"}),s.jsx(w,{children:"Enter your new password below"})]}),s.jsx(N,{children:s.jsx(A,{...o,children:s.jsxs("form",{onSubmit:o.handleSubmit(z),className:"space-y-4",children:[s.jsx(v,{control:o.control,name:"password",render:({field:t})=>s.jsxs(y,{children:[s.jsx(C,{children:"New password"}),s.jsx(P,{children:s.jsxs("div",{className:"relative",children:[s.jsx(S,{type:c?"text":"password",placeholder:"Enter new password",...t,disabled:e,className:"h-11 pr-10"}),s.jsx(n,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>I(!c),children:c?s.jsx(k,{className:"h-4 w-4"}):s.jsx(F,{className:"h-4 w-4"})})]})}),s.jsx(E,{})]})}),s.jsx(v,{control:o.control,name:"confirmPassword",render:({field:t})=>s.jsxs(y,{children:[s.jsx(C,{children:"Confirm new password"}),s.jsx(P,{children:s.jsxs("div",{className:"relative",children:[s.jsx(S,{type:d?"text":"password",placeholder:"Confirm new password",...t,disabled:e,className:"h-11 pr-10"}),s.jsx(n,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>R(!d),children:d?s.jsx(k,{className:"h-4 w-4"}):s.jsx(F,{className:"h-4 w-4"})})]})}),s.jsx(E,{})]})}),s.jsx(n,{type:"submit",className:"w-full h-11",disabled:e,children:e?"Updating password...":"Update password"})]})})}),s.jsx(f,{className:"flex justify-center",children:s.jsx(i,{href:"/auth",className:"text-sm text-muted-foreground hover:text-primary",children:"Back to login"})})]})})}):s.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gradient-to-br from-red-50 to-rose-100 p-4",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsxs(h,{className:"w-full shadow-xl border-0",children:[s.jsxs(x,{className:"space-y-1 text-center",children:[s.jsx("div",{className:"mx-auto w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mb-4",children:s.jsx(Y,{className:"w-6 h-6 text-red-600"})}),s.jsx(u,{className:"text-2xl font-bold text-red-700",children:"Invalid Reset Link"}
1),s.jsx(w,{children:"This password reset link is invalid or has expired"})]}),s.jsxs(f,{className:"flex flex-col space-y-3",children:[s.jsx(i,{href:"/forgot-password",className:"w-full",children:s.jsx(n,{className:"w-full h-11",children:"Request new reset link"})}),s.jsx(i,{href:"/auth",className:"w-full",children:s.jsx(n,{variant:"ghost",className:"w-full",children:"Back to login"})})]})]})})})}export{V 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.