PageSourceSearch

https://vidapeps.com/assets/ResetPassword-9yAHSlfI.js

js vidapeps.com collected 2026-10-04 08:09:19 UTC 6,924 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-query-CniT1WJL.js";import{u as A,e as L,r as a,L as o}from"./vendor-react-69GsFwrV.js";import{f as C,r as E,o as O,s as g}from"./vendor-forms-q6h4WU-p.js";import{B as j,L as k,I as y,h as T}from"./index-KjAD5lCC.js";import{aX as I,_,L as B}from"./vendor-ui-Ad3ANzF6.js";function D(t){return t.code==="INVALID_TOKEN"?{kind:"invalid-token"}:t.code==="PASSWORD_COMPROMISED"?{kind:"password-error",message:"This password was found in a known data breach. Choose a different password."}:t.code==="PASSWORD_TOO_SHORT"?{kind:"password-error",message:"Use at least 8 characters."}:t.code==="PASSWORD_TOO_LONG"?{kind:"password-error",message:"Use no more than 128 characters."}:t.code==="PASSWORD_CHECK_UNAVAILABLE"?{kind:"retryable",message:"We couldn't safely check this password. Your reset link has not been used, so please wait a moment and try again."}:t.code==="PASSWORD_RESET_UNAVAILABLE"||t.code==="AUTH_COOKIE_MIGRATION_UNAVAILABLE"?{kind:"retryable",message:"Password reset is temporarily unavailable. Your reset link has not been used, so please wait a moment and try again."}:t.status===429?{kind:"retryable",message:"Too many attempts were made. Your reset link is still valid, so wait and try again."}:{kind:"ambiguous",message:"We couldn't confirm whether your password changed. Try signing in with the new password. If that doesn't work, request a new reset link."}}const q=O({newPassword:g().min(8,"At least 8 characters").max(128,"No more than 128 characters"),confirmPassword:g().min(1,"Confirm your new password")}).refine(t=>t.newPassword===t.confirmPassword,{message:"Passwords do not match",path:["confirmPassword"]});function v({children:t,testId:l}){return e.jsx("div",{className:"min-h-[70vh] flex items-center justify-center px-4 py-8",children:e.jsx("div",{className:"w-full max-w-sm",children:e.jsx("div",{className:"vp-glass rounded-card p-6 text-center","data-testid":l,children:t})})})}function Y(){const[,t]=A(),l=L(),d=new URLSearchParams(l).get("token")??"",[u,h]=a.useState(!1),[m,N]=a.useState(!1),[S,b]=a.useState(!1),[x,w]=a.useState(null),[P,p]=a.useState(!1),[f,c]=a.useState(null),n=C({defaultValues:{newPassword:"",confirmPassword:""},validationLogic:E({mode:"submit",modeAfterSubmission:"change"}),validators:{onDynamic:q},onSubmit:async({value:s})=>{await R(s)}});a.useEffect(()=>{if(!m)return;const s=setTimeout(()=>t("/login"),2500);return()=>clearTimeout(s)},[m,t]);const R=async s=>{w(null),p(!1),c(null),h(!0);try{const{error:r}=await T.resetPassword({newPassword:s.newPassword,token:d});if(r){const i=D(r);i.kind==="invalid-token"?b(!0):i.kind==="password-error"?(c(i.message),document.querySelector('[data-testid="input-new-password"]')?.focus()):(w(i.message),p(i.kind==="ambiguous"))}else N(!0)}finally{h(!1)}};return!d||S?e.jsxs(v,{testId:"reset-token-error",children:[e.jsx("div",{className:"inline-flex items-center justify-center bg-amber-tint rounded-pill p-3 mb-3",children:e.jsx(I,{className:"w-7 h-7 text-amber","aria-hidden":"true"})}),e.jsx("h1",{className:"font-display text-t2 text-ink",children:d?"Link expired or invalid":"Invalid reset link"}),e.jsx("p",{className:"text-ink-3 text-sm mt-2",children:d?"This password reset link has expired or was already used. Request a new one to continue.":"This reset link is missing its token. Open the link from your email, or request a new one."}),e.jsx(j,{asChild:!0,className:"w-full mt-6","data-testid":"button-request-new-link",children:e.jsx(o,{href:"/forgot-password",children:"Request a new link"})}),e.jsx("p",{className:"text-center text-sm text-ink-3 mt-4",children:e.jsx(o,{href:"/login",className:"text-primary hover:underline font-medium","data-testid":"link-back-to-login",children:"Back to sign in"})})]}):m?e.jsxs(v,{testId:"reset-success",children:[e.jsx("div",{className:"inline-flex items-center justify-center bg-vida-mint-soft rounded-pill p-3 mb-3",children:e.jsx(_,{className:"w-7 h-7 text-vida-green-700","aria-hidden":"true"})}),e.jsx("h1",{className:"font-display text-t2 text-ink",children:"Password reset"}),e.jsx("p",{className:"text-ink-3 text-sm mt-2",children:"Your password has been updated. Redirecting you to sign in…"}),e.jsx("p",{className:"text-center text-sm text-ink-3 mt-6",children:e.jsx(o,{href:"/login",className:"text-primary hover:underline font-medium","data-testid":"link-sign-in-now",children:"Sign in now"})})]}):e.jsx("div",{className:"min-h-[70vh] flex items-center justify-center px-4 py-8",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center bg-vida-mint-soft rounded-pill p-3 mb-3",children:e.jsx(B,{className:"w-7 h-7 text-vida-green-700","aria-hidden":"true"})}),e.jsx("h1",{className:"font-display text-t2 text-ink",children:"Reset Password"}),e.jsx("p",{className:"text-ink-3 text-sm mt-1",children:"Choose a new password for your account"})]}),e.jsx("div",{className:"vp-glass rounded-card p-6",children:e.jsxs("form",{onSubmit:s=>{s.preventDefault(),s.stopPropagation(),n.handleSubmit()},className:"space-y-4",children:[e.jsx(n.Field,{name:"newPassword",children:s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:s.name,children:"New password"}),e.jsx(y,{id:s.name,name:s.name,type:"password",autoComplete:"new-password","data-testid":"input-new-password",value:s.state.value,onBlur:s.handleBlur,onChange:r=>{c(null),s.handleChange(r.target.value)}}),(s.state.meta.isTouched||n.state.submissionAttempts>0)&&s.state.meta.errors.length>0?e.jsx("p",{className:"text-danger text-sm",children:String(s.state.meta.errors[0]?.message??s.state.meta.errors[0])}):null,f?e.jsx("p",{className:"text-danger text-sm",role:"alert",children:f}):null]})}),e.jsx(n.Field,{name:"confirmPassword",children:s=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{htmlFor:s.name,children:"Confirm new password"}),e.jsx(y,{id:s.name,name:s.name,type:"password",autoComplete:"new-password","data-testid":"input-confirm-password",value:s.state.value,onBlur:s.handleBlur,onChange:r=>s.handleChange(r.target.value)}),(s.state.meta.isTouched||n.state.submissionAttempts>0)&&s.state.meta.errors.length>0?e.jsx("p",{className:"text-danger text-sm",children:String(s.state.meta.errors[0]?.message??s.state.meta.errors[0])}):null]})}),x?e.jsx("p",{className:"text-danger text-sm",role:"alert","data-testid":"reset-form-error",children:x}):null,P?e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-2 text-sm",children:[e.jsx(o,{href:"/login",className:"text-primary hover:underline font-medium",children:"Try signing in"}),e.jsx(o,{href:"/forgot-password",className:"text-primary hover:underline font-medium",children:"Request a new link"})]}):null,e.jsx(j,{type:"submit",className:"w-full",disabled:u,"data-testid":"button-reset-password",children:u?"Resetting...":"Reset Password"})]})})]})})}export{Y 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.