PageSourceSearch

https://splashiq.ai/assets/reset-password-BrZ-NrDB.js

js splashiq.ai collected 2026-10-05 12:43:18 UTC 3,216 bytes, 1 lines download raw bytes

1import{d as R,r as a,s as u,j as e,L as g,D as L,I as j,B as P,t as m}from"./index-CzAkNt2W.js";import{L as b}from"./label-BwWVuV93.js";function A(){const y=R(),[N,r]=a.useState(!1),[i,d]=a.useState(!1),[o,c]=a.useState(null),[l,v]=a.useState(""),[p,S]=a.useState(""),[h,w]=a.useState(!1);a.useEffect(()=>{const{data:{subscription:t}}=u.auth.onAuthStateChange(s=>{s==="PASSWORD_RECOVERY"&&(d(!0),r(!0))});return(async()=>{const s=new URL(window.location.href),f=s.searchParams.get("code"),x=s.searchParams.get("error_description")||s.hash.match(/error_description=([^&]+)/)?.[1];if(x){c(decodeURIComponent(x.replace(/\+/g," "))),r(!0);return}if(f){const{error:n}=await u.auth.exchangeCodeForSession(f);if(n){c(n.message),r(!0);return}s.searchParams.delete("code"),window.history.replaceState({},"",s.pathname+s.hash),d(!0),r(!0);return}setTimeout(()=>{d(n=>(n||(c("This password reset link is invalid or has expired. Request a new one."),r(!0)),n))},1500)})(),()=>t.unsubscribe()},[]);async function C(t){if(t.preventDefault(),l!==p){m.error("Passwords do not match");return}w(!0);try{const{error:s}=await u.auth.updateUser({password:l});if(s)throw s;m.success("Password updated. You're signed in."),y({to:"/dashboard"})}catch(s){m.error(s instanceof Error?s.message:"Could not update password")}finally{w(!1)}}return e.jsx("div",{className:"min-h-screen grid place-items-center p-6 bg-background",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs(g,{to:"/",className:"flex items-center gap-2 mb-8 justify-center",children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-water grid place-items-center",children:e.jsx(L,{className:"h-4 w-4 text-primary-foreground"})}),e.jsx("span",{className:"font-display text-lg font-bold",children:"SplashIQ"})]}),e.jsx("h1",{className:"font-display text-3xl font-bold",children:"Set a new password"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:o||(N?"Choose a new password for your account.":"Validating your reset link…")}),e.jsxs("form",{onSubmit:C,className:"mt-8 space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{htmlFor:"new-password",children:"New password"}),e.jsx(j,{id:"new-password",type:"password",value:l,onChange:t=>v(t.target.value),required:!0,minLength:12,pattern:"(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9]).{12,}",autoComplete:"new-password",disabled:!i||!!o}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use 12 or more characters with uppercase, lowercase, a number, and a symbol."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{htmlFor:"confirm-password",children:"Confirm new password"}),e.jsx(j,{id:"confirm-password",type:"password",value:p,onChange:t=>S(t.target.value),required:!0,minLength:12,pattern:"(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9]).{12,}",autoComplete:"new-password",disabled:!i||!!o})]}),e.jsx(P,{type:"submit",className:"w-full h-11",disabled:h||!i||!!o,children:h?"Updating…":"Update password"})]}),e.jsx("div",{className:"mt-6 text-center text-sm text-muted-foreground",children:e.jsx(g,{to:"/login",className:"hover:text-foreground transition-colors",children:"Back to sign in"})})]})})}export{A as component};

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.