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