0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.149.254.35


Current Path : /var/www/qpms/assets/
Upload File :
Current File : /var/www/qpms/assets/ChangePassword-BfiHQ9i_.js

import{v as w,E as o,M as j,x as T,r as d,y as _,t as e,D as L,L as A,B as h,F as x,A as k}from"./index-CdCh_UVF.js";import{S as P}from"./index-BhW39XJT.js";import{R as l,C as m}from"./row-2oeRoEGh.js";import"./responsiveObserver-C5nMCKxp.js";const N=a=>async(s,i)=>{try{const r=i();let n=localStorage.getItem("dbname");s({type:"SET_LOADER"});const t=await w.post("app.php?a=checkOldPassword&db="+n+"&univcode="+r.loginfo.userData.funivcode+"&oldpassword="+a+"&mobile="+r.loginfo.userData.fmobile+"&usertype="+r.loginfo.userData.fusertype);s({type:"UNSET_LOADER"}),t.data.error_code===0?s({type:"CHECK_PASSWORD",payload:t.data}):(s({type:"CHECK_PASSWORD",payload:t.data}),o("info",t.data.data.msg))}catch(r){o("error",r.message),s({type:"UNSET_LOADER"})}},R=a=>async(s,i)=>{try{const r=i();let n=localStorage.getItem("dbname");s({type:"SET_LOADER"});const t=await w.post("app.php?a=validatePwdOtp&db="+n+"&otp="+a+"&mobile="+r.loginfo.userData.fmobile+"&usertype="+r.loginfo.userData.fusertype);s({type:"UNSET_LOADER"}),t.data.error_code===0?s({type:"VALIDATE_OTP",payload:t.data}):(s({type:"VALIDATE_OTP",payload:t.data}),o("info",t.data.data.msg))}catch(r){o("error",r.message),s({type:"UNSET_LOADER"})}},B=(a,s,i)=>async(r,n)=>{try{const t=n();let f=localStorage.getItem("dbname");r({type:"SET_LOADER"});const u=await w.post("app.php?a=changeNewPassword&db="+f+"&newPwd="+a+"&mobile="+t.loginfo.userData.fmobile+"&usertype="+t.loginfo.userData.fusertype);r({type:"UNSET_LOADER"}),u.data.error_code===0?j.confirm({title:"Success",content:u.data.data.msg,okButtonProps:{style:{backgroundColor:"#8231d3",borderColor:"#8231d3"}},okText:"Logout",onOk(){i(s)},onCancel(){console.log("Cancelled")}}):o("info",u.data.data.msg)}catch(t){o("error",t.message),r({type:"UNSET_LOADER"})}},U=a=>{var p;const[s,i]=d.useState(""),[r,n]=d.useState(!1),[t,f]=d.useState(""),[u,O]=d.useState(!1),[g,b]=d.useState(""),[y,E]=d.useState(""),S=_();d.useEffect(()=>{a.oldPwdStatus.error_code===0&&n(!0)},[a.oldPwdStatus]),d.useEffect(()=>{a.validateCPOTP.error_code===0&&(n(!1),O(!0))},[a.validateCPOTP]);const C=async()=>{if(s==""){o("info","Enter Your Old Password");return}else await a.checkOldPassword(s)},v=async()=>{if(t===""){o("info","Enter Valid OTP");return}await a.validatePwdOtp(t)},D=async()=>{if(g===""){o("info","Enter new Password");return}if(g.length<8){o("info","Password should be atlease 8 characters");return}if(g!==y){o("info","new password and confirm password should be same");return}await a.changeNewPassword(g,S,a.logoutHandler)};return e.jsxs(L,{style:{margin:"6rem 10px 10px"},title:e.jsx("h6",{children:"Change Password"}),extra:e.jsx(P,{children:e.jsx(A,{to:"/",children:e.jsx(h,{type:"primary",danger:!0,children:"Exit"})})}),children:[e.jsx(j,{title:e.jsx("p",{children:"Enter OTP"}),footer:e.jsx(P,{children:e.jsx(h,{size:"medium",type:"primary",onClick:()=>v(),children:"OK"})}),width:400,open:r,closable:!1,children:e.jsx(l,{children:e.jsx(m,{xs:24,sm:24,md:24,lg:24,xl:24,xxl:24,children:e.jsx(x,{style:{marginBottom:"10px"},maxLength:6,value:t,onChange:c=>f(c.target.value)})})})}),e.jsx(l,{children:e.jsxs(m,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"User Name"}),e.jsx(x,{disabled:!0,style:{marginBottom:"10px"},value:a.data.fteachname})]})}),(a.data.fusertype==="T"||a.data.fusertype==="M")&&e.jsx(l,{children:e.jsxs(m,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"Teacher Code"}),e.jsx(x,{disabled:!0,style:{marginBottom:"10px"},value:a.data.fregno})]})}),e.jsx(l,{children:e.jsxs(m,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"Mobile Number"}),e.jsx(x,{disabled:!0,style:{marginBottom:"10px"},value:a.data.fmobile})]})}),!u&&e.jsx(l,{children:e.jsxs(m,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"Enter Old Password"}),e.jsx(x,{style:{marginBottom:"10px"},value:s,maxLength:50,onChange:c=>i(c.target.value)})]})}),((p=a.oldPwdStatus)==null?void 0:p.error_code)!==0&&e.jsx(l,{children:e.jsx(h,{type:"primary",style:{marginBottom:"10px"},onClick:()=>{C()},children:"Get OTP"})}),u&&e.jsxs("div",{children:[e.jsx(l,{children:e.jsxs(m,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"New Password"}),e.jsx(x,{style:{marginBottom:"10px"},value:g,maxLength:50,onChange:c=>b(c.target.value)})]})}),e.jsx(l,{children:e.jsxs(m,{xs:24,sm:24,md:12,lg:8,xl:8,xxl:8,children:[e.jsx("label",{children:"Confirm Password"}),e.jsx(x,{style:{marginBottom:"10px"},value:y,maxLength:50,onChange:c=>E(c.target.value)})]})}),e.jsx(l,{children:e.jsx(h,{type:"primary",style:{marginBottom:"10px"},onClick:()=>{D()},children:"Change Password"})})]})]})},I=a=>(console.log(a.checkOldPwd,"DSksdksd"),{data:a.loginfo.userData,oldPwdStatus:a.checkOldPwd,validateCPOTP:a.validateCPOTP}),W=T(I,{checkOldPassword:N,validatePwdOtp:R,changeNewPassword:B,logoutHandler:k})(U);export{W as default};