PageSourceSearch

https://qname.ai/assets/reset-password-Dv5WF_ez.js

js qname.ai collected 2026-10-05 16:37:56 UTC 2,862 bytes, 1 lines download raw bytes

1import{P as h,r as t,j as s,R as c,m as d,B as w,J as N,K as v,e as I,Y as R}from"./main-HVf8ATPQ.js";import{A as f}from"./auth-card-DLfQctxU.js";import{F as k}from"./form-error-Y84_5mtk.js";import{F as E}from"./form-success-CU_JCYv2.js";import{F as z,a as B,b as C,c as H,d as T,e as A}from"./form-BBBry7N8.js";import{I as M}from"./input-ePyCg58M.js";import{a as U}from"./zod-B2Wu2JFI.js";import{u as V}from"./index.esm-Boe4NRES.js";import{I as q}from"./IconEyeOff-BloCvZc6.js";import{I as J}from"./IconEye-BSVfHcvX.js";import{I as K}from"./IconLoader2-CRzzoIOT.js";import"./card-wN0xATCv.js";import"./IconCircleCheck-JquG_itO.js";import"./label-AxAuTRIG.js";const e=d.auth.resetPassword,O=N({password:v().min(8,{message:e.minLength})});function Y(){const x=typeof window<"u"?h(window.location.pathname):h(),m=typeof window<"u"?new URLSearchParams(window.location.search).get("token"):null,g=typeof window<"u"?new URLSearchParams(window.location.search).get("error"):null,[b,l]=t.useState(""),[j,P]=t.useState(""),[r,u]=t.useState(!1),[a,y]=t.useState(!1),n=V({resolver:U(O),defaultValues:{password:""}});if(!m||g==="invalid_token")return s.jsx(f,{headerLabel:e.title,bottomButtonLabel:e.backToLogin,bottomButtonHref:c.Login,children:s.jsx("p",{className:"text-sm text-destructive py-4",children:e.invalidToken})});const L=()=>{y(o=>!o)},F=async o=>{await I.resetPassword({newPassword:o.password,token:m},{onRequest:()=>{u(!0),l(""),P("")},onResponse:()=>u(!1),onSuccess:()=>{window.location.assign(R(c.Login,x))},onError:p=>{const i=p.error.code,S=i&&d.auth.error.codes[i]?d.auth.error.codes[i]:p.error.message;l(S)}})};return s.jsx(f,{headerLabel:e.title,bottomButtonLabel:e.backToLogin,bottomButtonHref:c.Login,children:s.jsx(z,{...n,children:s.jsxs("form",{onSubmit:n.handleSubmit(F),className:"space-y-6",children:[s.jsx("div",{className:"space-y-4",children:s.jsx(B,{control:n.control,name:"password",render:({field:o})=>s.jsxs(C,{children:[s.jsx(H,{children:e.password}),s.jsxs("div",{className:"relative",children:[s.jsx(T,{children:s.jsx(M,{...o,disabled:r,placeholder:e.placeholderPassword,type:a?"text":"password",className:"pr-10"})}),s.jsxs(w,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 border-0 bg-transparent hover:bg-transparent dark:hover:bg-transparent",onClick:L,disabled:r,children:[a?s.jsx(q,{className:"size-4 text-muted-foreground"}):s.jsx(J,{className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"sr-only",children:a?e.hidePassword:e.showPassword})]})]}),s.jsx(A,{})]})})}),s.jsx(k,{message:b}),s.jsx(E,{message:j}),s.jsxs(w,{disabled:r,size:"lg",type:"submit",className:"w-full flex items-center justify-center gap-2",children:[r&&s.jsx(K,{className:"mr-2 size-4 animate-spin"}),s.jsx("span",{children:e.reset})]})]})})})}function ns(){return s.jsx(Y,{})}export{ns 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.