1import{r as s,j as e,T as a,i as r,C as o}from"./mui-7de4f23d.js";import{u as t}from"./useApi-0ea0f466.js";import{c as i,a as d,u as l,o as n,C as c}from"./yup-57efa774.js";import{d as m,a as f,b as u}from"./VisibilityOff-d2e4b1c7.js";import{u as h}from"./index-bcc72886.js";import{a as p}from"./react-vendor-60cd4be3.js";import"./axiosInstance-7d68db82.js";import"./axios-c6845f15.js";import"./createSvgIcon-e6c3e379.js";const x={password:""},w=i().shape({password:d().required("Password is required").min(8,"Password must have minimum 8 charecters.").max(100,"Password must not have more then 100 charecters")}),j=()=>{const i=p(),{enqueueSnackbar:d}=h(),{apiCall:j,response:g,loading:v,error:b}=t("post"),[N,P]=s.useState(!1),[y,S]=s.useState(),{handleSubmit:k,control:C,formState:{errors:E,isValid:O}}=l({mode:"onChange",defaultValues:x,resolver:n(w)});s.useEffect(()=>{const s=window.location.search,e=new URLSearchParams(s).get("t");e||i("/"),S(e)},[]),s.useEffect(()=>{200===g?.status&&(d("Password reset successful. Redirecting to login...",{variant:"success"}),setTimeout(()=>{i("/login")},3e3))},[g]),s.useEffect(()=>{b?.response&&d(b?.response?.data?.msg||"Password reset failed. Please try again.",{variant:"error"})},[b]);const q=()=>{P(!N)};return e.jsx("div",{className:"flex items-center min-h-screen p-6 bg-gray-50",children:e.jsx("div",{className:"flex-1 h-full max-w-4xl mx-auto overflow-hidden bg-white rounded-lg shadow-xl ",children:e.jsxs("div",{className:"flex flex-col overflow-y-auto md:flex-row",children:[e.jsxs("div",{className:"h-32 md:h-auto md:w-1/2",children:[e.jsx("img",{"aria-hidden":"true",className:"object-cover w-full h-full dark:hidden",src:"img/forgot-password-office.jpeg",alt:"Office"}),e.jsx("img",{"aria-hidden":"true",className:"hidden object-cover w-full h-full dark:block",src:"img/forgot-password-office-dark.jpeg",alt:"Office"})]}),e.jsx("div",{className:"flex items-center justify-center p-6 sm:p-12 md:w-1/2",children:e.jsxs("div",{className:"w-full",children:[e.jsx("h1",{className:"text-xl font-semibold text-gray-700 ",children:"Enter New Password"}),e.jsxs("form",{onSubmit:k(({password:s})=>{j("/api/change-password",{newPassword:s,token:y})}),children:[e.jsx("div",{className:"h-28 overflow-hidden",children:e.jsx(c,{name:"password",control:C,render:({field:s})=>e.jsx(a,{...s,label:"Password",variant:"outlined",className:"!mt-8",placeholder:"Password",inputProps:{className:"font-[Lato] leading-loose"},type:N?"text":"password",InputProps:{startAdornment:e.jsx(m,{}),endAdornment:e.jsx(r,{onClick:q,children:N?e.jsx(f,{}):e.jsx(u,{})})},fullWidth:!0,error:!!E.password,helperText:E.password?.message})})}),e.jsx("button",{disabled:!O||v,type:"submit",className:"w-full h-10 rounded-full !text-white bg-[#3F4BF2] disabled:bg-gray-400 font-[Lato] font-semibold text-[18px] shadow-lg mt-4",children:v?e.jsxs("span",{children:[e.jsx(o,{size:20})," Please wait"]}):"Save new password"})]})]})})]})})})};export{j 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.