"use strict";(self["webpackChunkTruckShop"]=self["webpackChunkTruckShop"]||[]).push([[6934],{6934:function(s,e,r){r.r(e),r.d(e,{default:function(){return x}});var a=r(6768),o=r(5130),t=r(4232);const l={class:"auth-main v2"},n={class:"auth-wrapper"},c={class:"auth-form"},d={class:"card my-5 mx-3"},i={style:{direction:"rtl"},class:"card-body"},u={class:"text-center mb-4"},p=["src"],v={class:"mb-3"},m={class:"mb-3"},w={key:0,class:"text-danger"},k={class:"mb-3"},g={key:0,class:"text-danger"},b={class:"d-grid mt-4"},f=["disabled"],P={key:0,class:"spinner-border spinner-border-sm",role:"status","aria-hidden":"true"},h={key:1};function y(s,e,r,y,L,E){const R=(0,a.g2)("router-link"),C=(0,a.g2)("Rightbar");return(0,a.uX)(),(0,a.CE)(a.FK,null,[(0,a.Lk)("div",l,[e[10]||(e[10]=(0,a.Lk)("div",{class:"bg-overlay bg-dark"},null,-1)),(0,a.Lk)("div",n,[(0,a.Lk)("div",c,[(0,a.Lk)("div",d,[(0,a.Lk)("div",i,[(0,a.Lk)("div",u,[(0,a.Lk)("img",{src:y.logo,alt:"Logo",class:"styled-logo"},null,8,p)]),e[9]||(e[9]=(0,a.Lk)("h4",{class:"f-w-500 mb-1"},"بازنشانی رمز عبور",-1)),(0,a.Lk)("p",v,[e[6]||(e[6]=(0,a.eW)(" باز گشت به صفحه ",-1)),(0,a.bF)(R,{to:"/login-v2",class:"link-primary"},{default:(0,a.k6)((()=>e[5]||(e[5]=[(0,a.eW)("ورود",-1)]))),_:1,__:[5]})]),(0,a.Lk)("div",m,[e[7]||(e[7]=(0,a.Lk)("label",{class:"form-label"},"رمز عبور جدید",-1)),(0,a.bo)((0,a.Lk)("input",{onInput:e[0]||(e[0]=s=>y.clearError("newPassword")),type:"password",class:"form-control","onUpdate:modelValue":e[1]||(e[1]=s=>y.newPassword=s),placeholder:"رمز عبور جدید"},null,544),[[o.Jo,y.newPassword]]),y.errors.newPassword?((0,a.uX)(),(0,a.CE)("small",w,(0,t.v_)(y.errors.newPassword),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("div",k,[e[8]||(e[8]=(0,a.Lk)("label",{class:"form-label"},"تکرار رمز عبور",-1)),(0,a.bo)((0,a.Lk)("input",{onInput:e[2]||(e[2]=s=>y.clearError("confirmPassword")),type:"password",class:"form-control","onUpdate:modelValue":e[3]||(e[3]=s=>y.confirmPassword=s),placeholder:"تکرار رمز عبور"},null,544),[[o.Jo,y.confirmPassword]]),y.errors.confirmPassword?((0,a.uX)(),(0,a.CE)("small",g,(0,t.v_)(y.errors.confirmPassword),1)):(0,a.Q3)("",!0)]),(0,a.Lk)("div",b,[(0,a.Lk)("button",{onClick:e[4]||(e[4]=(...s)=>y.resetPassword&&y.resetPassword(...s)),type:"button",class:"btn btn-primary",disabled:y.loading},[y.loading?((0,a.uX)(),(0,a.CE)("span",P)):((0,a.uX)(),(0,a.CE)("span",h," بازنشانی "))],8,f)])])])])])]),(0,a.bF)(C)],64)}r(4114);var L=r(782),E=r(9317),R=r(144),C=r(1387),A=r(4874),_=r.n(A),K={name:"RESET-PASSWORD",components:{},setup(){const s=(0,R.KR)(),e=(0,R.KR)(),r=(0,C.rd)(),o=(0,R.KR)(!1),t=(0,R.KR)({}),l=(0,L.Pj)(),n=(0,R.KR)(""),c=(0,R.KR)(""),d=async()=>{if(i()){o.value=!0;try{await l.dispatch("user/resetPassword",{newPassword:n.value,confirmPassword:c.value}),r.push({name:"login-v2"}),o.value=!1}catch(s){console.error(s),o.value=!1,_().fire({icon:"error",text:`${s.message}`,confirmButtonText:"باشه"})}}},i=()=>(t.value={},n.value?n.value.length<8&&(t.value.newPassword="رمز عبور باید حداقل ۸ کاراکتر باشد"):t.value.newPassword="رمز عبور جدید را وارد نمایید",c.value?c.value!==n.value&&(t.value.confirmPassword="رمز عبور و تکرار آن باید یکسان باشند"):t.value.confirmPassword="رمز عبور را تکرار کنید",0===Object.keys(t.value).length),u=s=>{t.value[s]=""},p=async()=>{s.value=localStorage.getItem("logo");try{const s=await E.A.get("settings/logo_fav");e.value=s.data.data}catch(r){console.error("Error fetching settings:",r)}};return(0,a.sV)((()=>{p()})),{newPassword:n,confirmPassword:c,resetPassword:d,clearError:u,errors:t,loading:o,logo:s}}},S=r(1241);const j=(0,S.A)(K,[["render",y],["__scopeId","data-v-3d14a078"]]);var x=j},9317:function(s,e,r){r(4114);var a=r(4373),o=r(494);const t="http://85.208.254.227/api/v1/",l=a.A.create({baseURL:t,headers:{Accept:"application/json","Content-Type":"application/json"}});l.interceptors.request.use((s=>{const e=localStorage.getItem("token");return e&&(s.headers["Authorization"]=`Bearer ${e}`),s}),(s=>Promise.reject(s))),l.interceptors.response.use((s=>s),(s=>(401===s?.status&&o.A.push({name:"login-v2"}),Promise.reject(s)))),e.A=l}}]);
//# sourceMappingURL=6934.c918278d.js.map