PageSourceSearch

https://analyticsindiamag.com/assets/ResetPassword-BvqM9goK.js

js analyticsindiamag.com collected 2026-09-24 08:26:35 UTC 2,763 bytes, 1 lines download raw bytes

1import{r as n,a as y,e as b,s as o,j as s,H as N,B as h,I as x}from"./index-KSWbwNeY.js";import{L as w}from"./label-ndOKmXJw.js";import{s as S,Z as C}from"./schemas-eq1hNim8.js";const P=S().min(8,"Password must be at least 8 characters").max(72,"Password is too long"),E=()=>{const[f,i]=n.useState(!1),[g,d]=n.useState(!1),[c,l]=n.useState(!1),{toast:a}=y(),u=b();n.useEffect(()=>{const{data:r}=o.auth.onAuthStateChange((e,t)=>{t&&(d(!0),i(!0))});return o.auth.getSession().then(({data:e})=>{d(!!e.session),i(!0)}),()=>r.subscription.unsubscribe()},[]);const j=async r=>{r.preventDefault();const e=new FormData(r.currentTarget),t=String(e.get("password")||""),v=String(e.get("confirm")||"");try{P.parse(t)}catch(p){p instanceof C&&a({variant:"destructive",title:"Invalid password",description:p.issues[0].message});return}if(t!==v){a({variant:"destructive",title:"Passwords don't match",description:"Please re-enter the same password."});return}l(!0);const{error:m}=await o.auth.updateUser({password:t});if(l(!1),m){a({variant:"destructive",title:"Couldn't update password",description:m.message});return}a({title:"Password updated",description:"You're signed in with your new password."}),u("/")};return s.jsxs(s.Fragment,{children:[s.jsxs(N,{children:[s.jsx("title",{children:"Reset Password — AIM"}),s.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background text-foreground font-sans px-4",children:s.jsxs("div",{className:"w-full max-w-sm space-y-6",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h1",{className:"text-2xl font-medium",children:"Set a new password"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose a strong password you haven't used before."})]}),f?g?s.jsxs("form",{onSubmit:j,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(w,{htmlFor:"password",children:"New password"}),s.jsx(x,{id:"password",name:"password",type:"password",autoComplete:"new-password",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(w,{htmlFor:"confirm",children:"Confirm password"}),s.jsx(x,{id:"confirm",name:"confirm",type:"password",autoComplete:"new-password",required:!0})]}),s.jsx(h,{type:"submit",className:"w-full",disabled:c,children:c?"Updating…":"Update password"})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"This reset link is invalid or has expired. Request a new one from the sign-in page."}),s.jsx(h,{onClick:()=>u("/auth"),className:"w-full",children:"Back to sign in"})]}):s.jsx("p",{className:"text-sm text-muted-foreground",children:"Checking your reset link…"})]})})]})};export{E 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.