1import{o as A,r,j as s,as as P,a6 as N}from"./vendor-BVgZHX98.js";import{L as b}from"./react-router-gNCewEo-.js";import{a as k}from"./axios-DcNlVx-A.js";import{n as F,g as L,e as p,o as m,p as h,q as f,A as B}from"./index-DVXlwtlI.js";function Z(){const{token:x}=A(),[l,i]=r.useState(!1),[c,d]=r.useState(null),[j,w]=r.useState(!1),[t,g]=r.useState(""),[a,y]=r.useState(""),[S,u]=r.useState(null),[E,o]=r.useState(null);function M(e){return e?e.length>=8&&/[A-Za-z]/.test(e)&&/\d/.test(e)&&/[^A-Za-z0-9]/.test(e)?null:"ÐикоÑиÑÑовÑйÑе 8+ ÑимволÑв з лÑÑеÑами, ÑиÑÑами Ñа ÑпеÑÑалÑними знаками":"ÐаÑÐ¾Ð»Ñ Ñ Ð¾Ð±Ð¾Ð²'Ñзковим"}async function v(e){e.preventDefault(),u(null),o(null),d(null);const n=M(t);if(n){u(n);return}if(!a){o("ÐÑдÑвеÑдÑÑÑ Ð¿Ð°ÑолÑ.");return}if(t!==a){o("ÐаÑÐ¾Ð»Ñ Ð½Ðµ збÑгаÑÑÑÑÑ");return}i(!0);try{await k.post(`${B}/api/v1/auth/password-reset/confirm/`,{token:x,password:t}),w(!0),N.success("ÐаÑÐ¾Ð»Ñ ÑÑпÑÑно змÑнено. Ð¢ÐµÐ¿ÐµÑ Ð¼Ð¾Ð¶ÐµÑе ÑвÑйÑи.")}catch(C){d(C?.response?.data?.detail||"Ðе вдалоÑÑ ÑкинÑÑи паÑолÑ. Ðожливо, поÑÐ¸Ð»Ð°Ð½Ð½Ñ Ð½ÐµÐ´ÑйÑне або пÑоÑÑÑоÑене.")}finally{i(!1)}}return s.jsxs(s.Fragment,{children:[s.jsx(P,{richColors:!0}),s.jsx(F,{title:"Ðовий паÑолÑ",description:"СÑвоÑÑÑÑ ÑилÑний паÑÐ¾Ð»Ñ Ð´Ð»Ñ Ð±ÐµÐ·Ð¿ÐµÑного доÑÑÑÐ¿Ñ Ð´Ð¾ ÑобоÑÐ¾Ñ Ð¿Ð°Ð½ÐµÐ»Ñ.",children:s.jsxs("div",{className:"space-y-5",children:[c?s.jsx(L,{title:"Ðе вдалоÑÑ Ð·Ð¼ÑниÑи паÑолÑ",tone:"danger",children:c}):null,j?s.jsx(p,{asChild:!0,variant:"primary",className:"w-full",children:s.jsx(b,{to:"/login",children:"ÐеÑейÑи до Ð²Ñ Ð¾Ð´Ñ"})}):s.jsxs("form",{className:"space-y-4",onSubmit:v,noValidate:!0,children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(m,{htmlFor:"password",children:"Ðовий паÑолÑ"}),s.jsx(h,{id:"password",type:"password",autoComplete:"new-password",placeholder:"8+ ÑимволÑв, ÑиÑÑа Ñ ÑпеÑÑимвол",value:t,onChange:e=>g(e.target.value)}),s.jsx(f,{children:S})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(m,{htmlFor:"confirm",children:"ÐÑдÑвеÑдÑÑÑ Ð¿Ð°ÑолÑ"}),s.jsx(h,{id:"confirm",type:"password",autoComplete:"new-password",placeholder:"ÐовÑоÑÑÑÑ Ð¿Ð°ÑолÑ",value:a,onChange:e=>y(e.target.value)}),s.jsx(f,{children:E})]}),s.jsx(p,{type:"submit",variant:"primary",className:"w-full",disabled:l,children:l?"ÐмÑнÑÑмо паÑолÑ...":"ÐмÑниÑи паÑолÑ"})]})]})})]})}export{Z as default}; 2//# sourceMappingURL=ResetPassword-B7nWU1Pm.js.map
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.