import{aa as g,cm as S,cA as k,cG as T,cl as A,cR as N,ct as B,X as p,cS as e,p as R,bB as n,a3 as a,cV as x,aV as v,c7 as t,a2 as c,c0 as m,Z as F,F as P,V as O,Y as j,bO as w,bj as G,l as I}from"#entry";import{V as U}from"./D-zBkYGg.js";import{a as D,V as E}from"./CSNDbwpJ.js";import{V as H,b as M,a as W}from"./RTCSF0Ks.js";import{V as y}from"./R1_j74h_.js";import{V as X}from"./C2L9cD_h.js";import{V as Y}from"./C8MHOe0D.js";import{V as Z}from"./BgQ5eU58.js";import{V as q}from"./VoZA954X.js";import"./BbcaTmac.js";import"./D_qxKlPu.js";import"./BKDgfSxC.js";import"./Cp3UUybv.js";import"./DmHQoNBb.js";import"./CEoxYnb5.js";import"./BPHK4Dzs.js";const ie=g({__name:"[code]",async setup(z){let s,f;const{t:C}=S(),b=k(),h=T("settings");A({title:`${h.value.title} - ${C("common.recover_password")}`});const V=b.params.code,r=w(""),l=w(!1),u=([s,f]=N(()=>$fetch("/api/user/check_recover_code",{method:"POST",body:{recover_code:V}}).catch(()=>{})),s=await s,f(),s),{$notify:_}=B();async function $(){try{await $fetch("/api/user/recover_password",{method:"POST",body:{recover_code:V,password:r.value}}),_("common.password_updated"),G("/login")}catch(o){_(o,I.WARNING)}}return(o,d)=>(n(),p(R,null,{default:e(()=>[a(U,{modelValue:t(l),"onUpdate:modelValue":d[1]||(d[1]=i=>v(l)?l.value=i:null),onSubmit:x($,["prevent"])},{default:e(()=>[a(D,{class:"mt-5",align:"center",justify:"center"},{default:e(()=>[a(E,{cols:"12",md:"6",lg:"5",xl:"4"},{default:e(()=>[a(H,null,{default:e(()=>[a(M,null,{default:e(()=>[c(m(o.$t("common.recover_password")),1)]),_:1}),t(u)?(n(),F(P,{key:0},[a(W,null,{default:e(()=>[c(m(t(u).email),1)]),_:1}),a(y,null,{default:e(()=>[a(X,{modelValue:t(r),"onUpdate:modelValue":d[0]||(d[0]=i=>v(r)?r.value=i:null),type:"password",rules:[o.$valid.password],autofocus:"",placeholder:o.$t("common.new_password")},null,8,["modelValue","rules","placeholder"])]),_:1})],64)):(n(),p(y,{key:1},{default:e(()=>[a(Y,{type:"error",icon:"mdi-alert"},{default:e(()=>[c(m(o.$t("recover.not_valid_code")),1)]),_:1})]),_:1})),a(Z,null,{default:e(()=>[a(q),t(u)?(n(),p(O,{key:0,variant:"outlined",color:"primary",type:"submit",disabled:!t(l)},{default:e(()=>[c(m(o.$t("common.send")),1)]),_:1},8,["disabled"])):j("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}))}});export{ie as default};
