1import{h as B,r as M,c as U,f as m,K as P,L as b,n as r,a0 as n,$ as l,a1 as d,aa as I,a4 as k,a7 as O,_ as T,u as a,F as z,M as p}from"./vue-datepicker-CpIdsRIT.js";import{_ as D}from"./CardContainer.vue_vue_type_script_setup_true_lang-BKfUFWAw.js";import{V as H,r as w,e as K,p as j,m as G}from"./VForm-DE7HWpqe.js";import{u as J,a as Q,b as W,o as X,e as Y,z as Z,x as E,V as $,y as ee}from"./index-o4dhNVJj.js";import{r as q}from"./ResolveErrorCode-uRcKEtjn.js";import{u as se}from"./ResendCooldownComposable-DcO-CUaE.js";import{V as f}from"./VTextField-DmCcBAfM.js";import"./datefns-BAflKSlV.js";const ae={class:"flex flex-col gap-3 mt-8"},oe={class:"text-2xl"},te={key:0,class:"text-center"},re={class:"text-center"},fe=B({__name:"ResetPassword",setup(ne){const h=X(),v=J(),{notifyError:A,notifySuccess:x}=Q(),{t:i}=W(),u=h.currentRoute.value?.query,s=M({email:u?.email??"",code:u?.code??"",password:"",passwordConfirm:""}),y=U(()=>!!(u?.email&&u?.code)),N=G(()=>s.password),g=m(!1),V=m(!1),C=m(!1),R=m(!1),{remaining:c,start:L}=se(60),S=async()=>{V.value=!0;try{await v.confirmResetPassword(s.email,s.password,s.code),x(i("Auth.ResetPassword.passwordSet"));try{await v.signIn(s.email,s.password),await h.push({name:"cockpit"})}catch{await h.push({name:"login"})}}catch(e){const o=ee(e)?e?.response?.data?.code:null;["ExpiredCodeException","CodeMismatchException","LimitExceededException"].includes(o)&&(C.value=o!=="LimitExceededException"),A(i(q(e,"Auth.ResetPassword.genericError")))}V.value=!1},F=async()=>{if(!(c.value>0)){R.value=!0;try{await v.resetPassword(s.email),x(i("Auth.ForgotPassword.emailSend")),L()}catch(e){A(i(q(e,"Auth.ForgotPassword.genericError")))}R.value=!1}};return(e,o)=>{const _=I("router-link");return p(),P("div",ae,[b("span",oe,n(e.$t("Auth.ResetPassword.title")),1),r(D,{class:"flex flex-col gap-3 p-6 sm:w-[60dvw]"},{default:l(()=>[b("span",null,n(y.value?e.$t("Auth.ResetPassword.headingLink"):e.$t("Auth.ResetPassword.heading")),1),r(H,{modelValue:g.value,"onUpdate:modelValue":o[4]||(o[4]=t=>g.value=t),class:"flex flex-col gap-3",onSubmit:O(S,["prevent"])},{default:l(()=>[r(f,{modelValue:s.email,"onUpdate:modelValue":o[0]||(o[0]=t=>s.email=t),label:e.$t("Auth.ResetPassword.email"),type:"email",color:"secondary","prepend-inner-icon":a(Y),rules:[a(w),a(K)],variant:"outlined","hide-details":"auto",readonly:y.value,required:""},null,8,["modelValue","label","prepend-inner-icon","rules","readonly"]),y.value?k("",!0):(p(),T(f,{key:0,modelValue:s.code,"onUpdate:modelValue":o[1]||(o[1]=t=>s.code=t),label:e.$t("Auth.ResetPassword.code"),type:"text",color:"secondary","prepend-inner-icon":a(Z),rules:[a(w)],variant:"outlined","hide-details":"auto",required:""},null,8,["modelValue","label","prepend-inner-icon","rules"])),r(f,{modelValue:s.password,"onUpdate:modelValue":o[2]||(o[2]=t=>s.password=t),label:e.$t("Auth.ResetPassword.password"),type:"password",color:"secondary","prepend-inner-icon":a(E),rules:[a(w),a(j)],variant:"outlined","hide-details":"auto",required:""},null,8,["modelValue","label","prepend-inner-icon","rules"]),r(f,{modelValue:s.passwordConfirm,"onUpdate:modelValue":o[3]||(o[3]=t=>s.passwordConfirm=t),label:e.$t("Auth.ResetPassword.confirmPassword"),type:"password",color:"secondary","prepend-inner-icon":a(E),rules:[a(w),a(N)],variant:"outlined","hide-details":"auto",required:""},null,8,["modelValue","label","prepend-inner-icon","rules"]),r($,{loading:V.value,disabled:!g.value,type:"submit",color:"secondary",height:"46",style:{"background-image":"linear-gradient(45deg,#d73625,#F78361)!important"}},{default:l(()=>[d(n(e.$t("Auth.ResetPassword.confirm")),1)]),_:1},8,["loading","disabled"])]),_:1},8,["modelValue"]),C.value?(p(),P("div",te,[r($,{variant:"text",color:"info",loading:R.value,disabled:a(c)>0,onClick:F},{default:l(()=>[d(n(e.$t("Auth.ResetPassword.requestNewLink")),1),a(c)>0?(p(),P(z,{key:0},[d(" ("+n(a(c))+"s)",1)],64)):k("",!0)]),_:1},8,["loading","disabled"])])):k("",!0)]),_:1}),b("span",re,[d(n(e.$t("Auth.ResetPassword.newHere"))+" ",1),r(_,{to:{name:"register"},class:"text-info underline"},{default:l(()=>[d(n(e.$t("Auth.ResetPassword.createAccount")),1)]),_:1})])])}}});
1export{fe 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.