PageSourceSearch

https://patchcv.dev/assets/reset-password-BcXCSi6k.js

js patchcv.dev collected 2026-10-02 01:53:44 UTC 3,489 bytes, 1 lines download raw bytes

1import{e as S,l as k,r as s,s as d,j as e,L,t as u}from"./index-CGSm1aUL.js";import{L as x}from"./loader-circle-r_fbDZqs.js";import"./createLucideIcon-BhM3PfiJ.js";function C(){const b=S(),{email:g}=k.useSearch(),[a,l]=s.useState(g??""),[c,y]=s.useState(""),[m,w]=s.useState(""),[p,f]=s.useState(!1),[o,n]=s.useState(!1);s.useEffect(()=>{const r=(typeof window<"u"?window.location.hash:"").includes("type=recovery"),{data:{subscription:N}}=d.auth.onAuthStateChange((i,h)=>{i==="PASSWORD_RECOVERY"&&h&&(l(h.user.email??""),f(!0))});return r&&d.auth.getSession().then(({data:i})=>{i.session&&(l(i.session.user.email??""),f(!0))}),()=>N.unsubscribe()},[]);const v=async t=>{t.preventDefault(),n(!0);const{error:r}=await d.auth.verifyOtp({email:a,token:c.trim(),type:"recovery"});if(n(!1),r){u.error(r.message);return}f(!0)},j=async t=>{if(t.preventDefault(),m.length<8){u.error("Password must be at least 8 characters.");return}n(!0);const{error:r}=await d.auth.updateUser({password:m});if(n(!1),r){u.error(r.message);return}u.success("Password updated."),b({to:"/dashboard"})};return e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center bg-background px-4 py-12",children:[e.jsx("div",{className:"absolute inset-0 -z-10 bg-hero-glow opacity-80"}),e.jsxs("div",{className:"w-full max-w-md rounded-xl border border-border/70 bg-card p-8 shadow-soft",children:[e.jsx("h1",{className:"font-display text-2xl font-semibold tracking-tight",children:p?"Set a new password":"Enter your reset code"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:p?"Pick something you'll remember this time.":`We sent an 8-digit code${a?` to ${a}`:""}.`}),p?e.jsxs("form",{onSubmit:j,className:"mt-6 space-y-4",children:[e.jsx("input",{type:"password",required:!0,minLength:8,value:m,onChange:t=>w(t.target.value),placeholder:"min. 8 characters",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none ring-primary/40 focus:ring-2"}),e.jsxs("button",{type:"submit",disabled:o,className:"inline-flex w-full items-center justify-center gap-2 rounded-md bg-primary py-2.5 font-mono text-sm font-medium text-primary-foreground transition hover:opacity-90 disabled:opacity-50",children:[o&&e.jsx(x,{className:"h-4 w-4 animate-spin"}),"$ update password"]})]}):e.jsxs("form",{onSubmit:v,className:"mt-6 space-y-4",children:[!g&&e.jsx("input",{type:"email",required:!0,value:a,onChange:t=>l(t.target.value),placeholder:"[email protected]",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm outline-none ring-primary/40 focus:ring-2"}),e.jsx("input",{required:!0,inputMode:"numeric",pattern:"[0-9]*",maxLength:8,value:c,onChange:t=>y(t.target.value.replace(/\D/g,"")),placeholder:"00000000",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-center font-mono text-lg tracking-[0.4em] outline-none ring-primary/40 focus:ring-2"}),e.jsxs("button",{type:"submit",disabled:o||c.length<6,className:"inline-flex w-full items-center justify-center gap-2 rounded-md bg-primary py-2.5 font-mono text-sm font-medium text-primary-foreground transition hover:opacity-90 disabled:opacity-50",children:[o&&e.jsx(x,{className:"h-4 w-4 animate-spin"}),"$ verify code"]})]}),e.jsx("p",{className:"mt-6 text-center font-mono text-xs text-muted-foreground",children:e.jsx(L,{to:"/login",className:"text-primary hover:underline",children:"/login"})})]})]})}export{C 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.