PageSourceSearch

https://trysteadier.app/assets/ResetPasswordPage-CSDxXiiO.js

js trysteadier.app collected 2026-10-02 15:59:50 UTC 5,795 bytes, 1 lines download raw bytes

1import{j as e,m as p}from"./vendor-motion-CrVg7028.js";import{d as D,r}from"./vendor-react-CMYciJPr.js";import{x as F,u as U,ax as x,aD as h,s as a,j as n,aE as V}from"./index-B58eJlvC.js";import"./vendor-query-C4LcE4u2.js";import"./vendor-supabase-XOXmZWMk.js";const z=()=>{const{resolvedTheme:l}=F(),g=D(),{refreshProfile:C}=U(),[i,E]=r.useState(""),[y,R]=r.useState(""),[w,b]=r.useState(!1),[v,d]=r.useState(null),[c,L]=r.useState(""),[j,N]=r.useState(!1),[u,m]=r.useState(null),[k,S]=r.useState(!1),[O,P]=r.useState(null);r.useEffect(()=>{(async()=>{const s=new URLSearchParams(window.location.search),o=s.get("token_hash"),_=s.get("type"),f=s.get("code");if((_==="recovery"||s.get("flow")==="recovery"||o||f)&&V(),o){m(o),d(!1);return}f&&await a.auth.exchangeCodeForSession(f);const{data:{session:H}}=await a.auth.getSession();d(!!H)})()},[]);const T=async()=>{if(!u)return;S(!0),P(null);const{error:t}=await a.auth.verifyOtp({token_hash:u,type:"recovery"});if(S(!1),t){P(t.message),m(null);return}m(null);const{data:{session:s}}=await a.auth.getSession();d(!!s)},q=async t=>{if(t.preventDefault(),i!==y){n({title:"Passwords don't match",variant:"destructive"});return}if(i.length<6){n({title:"Password must be at least 6 characters",variant:"destructive"});return}b(!0);const{error:s}=await a.auth.updateUser({password:i});if(s)n({title:"Failed to update password",description:s.message,variant:"destructive"});else{const{data:{user:o}}=await a.auth.getUser();o&&await a.from("profiles").update({has_set_password:!0}).eq("user_id",o.id),n({title:"Password updated!",description:"You're all set."}),h(),await C(),g("/")}b(!1)};return v===null?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:e.jsx("p",{className:"text-muted-foreground",children:"Loading..."})}):u?e.jsx("div",{className:"flex min-h-screen flex-col items-center justify-center bg-background px-6",children:e.jsxs(p.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-sm text-center",children:[e.jsx(x,{variant:l==="dark"?"mist":"forest",className:"mx-auto h-12"}),e.jsx("h2",{className:"mt-6 text-lg font-semibold text-foreground",children:"Reset your password"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Tap below to continue and choose a new password."}),e.jsx("button",{type:"button",onClick:T,disabled:k,className:"mt-6 w-full rounded-xl bg-primary py-3 text-sm font-semibold text-primary-foreground transition-transform active:scale-[0.98] disabled:opacity-50",children:k?"Verifying...":"Continue to reset password"})]})}):v?e.jsx("div",{className:"flex min-h-screen flex-col items-center justify-center bg-background px-6",children:e.jsxs(p.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"w-full max-w-sm",children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsx(x,{variant:l==="dark"?"mist":"forest",className:"mx-auto h-12"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Set your password"})]}),e.jsxs("form",{onSubmit:q,className:"space-y-4",children:[e.jsx("input",{type:"password",placeholder:"New password",value:i,onChange:t=>E(t.target.value),className:"w-full rounded-xl border border-border bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary",required:!0,minLength:6}),e.jsx("input",{type:"password",placeholder:"Confirm password",value:y,onChange:t=>R(t.target.value),className:"w-full rounded-xl border border-border bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary",required:!0,minLength:6}),e.jsx("button",{type:"submit",disabled:w,className:"w-full rounded-xl bg-primary py-3 text-sm font-semibold text-primary-foreground transition-transform active:scale-[0.98] disabled:opacity-50",children:w?"...":"Set Password"})]})]})}):e.jsx("div",{className:"flex min-h-screen flex-col items-center justify-center bg-background px-6",children:e.jsxs(p.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},className:"w-full max-w-sm text-center",children:[e.jsx(x,{variant:l==="dark"?"mist":"forest",className:"mx-auto h-12"}),e.jsx("h2",{className:"mt-6 text-lg font-semibold text-foreground",children:"This link has expired"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Password reset links can only be used once, and expire after a short while. Enter your email and we'll send a fresh one."}),e.jsxs("form",{className:"mt-6 space-y-3",onSubmit:async t=>{if(t.preventDefault(),!c.trim())return;N(!0),h();const{error:s}=await a.auth.resetPasswordForEmail(c.trim(),{redirectTo:`${window.location.origin}/auth/callback?flow=recovery`});N(!1),s?n({title:"Couldn't send link",description:s.message,variant:"destructive"}):n({title:"Check your email",description:"We sent you a new password reset link."})},children:[e.jsx("input",{type:"email",placeholder:"Email address",value:c,onChange:t=>L(t.target.value),className:"w-full rounded-xl border border-border bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary",required:!0}),e.jsx("button",{type:"submit",disabled:j,className:"w-full rounded-xl bg-primary py-3 text-sm font-semibold text-primary-foreground transition-transform active:scale-[0.98] disabled:opacity-50",children:j?"Sending...":"Send new reset link"}),e.jsx("button",{type:"button",onClick:async()=>{h(),await a.auth.signOut(),g("/")},className:"w-full rounded-xl border border-border py-3 text-sm font-semibold text-foreground transition-transform active:scale-[0.98]",children:"Back to sign in"})]})]})})};export{z 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.