import{J as S,Y as $,L as T,M as g,A as V,B as e,C as h,N as k,E as i,b as a,a6 as B,G as s,Q as l,S as d,T as R,F as A,a8 as F,V as N,c as x,a4 as _,Z as w,$ as E}from"#entry";import{V as O,a as D}from"./KZF8CoAo.js";import{V as M}from"./gMmVrYwQ.js";import{V as P,a as U,b as Y}from"./DlybGOWB.js";import{V as y}from"./DArAxlee.js";import{V as j}from"./tRJ_cXK7.js";import{V as G}from"./DSnRMG2T.js";import{V as J}from"./D1vV9CHW.js";import{V as L}from"./C63UuyGC.js";import"./xGkJbl6f.js";import"./D_qxKlPu.js";import"./BML-0xFj.js";import"./CIr4U5gS.js";import"./C1aoz2cp.js";import"./LWaCnj-p.js";import"./0VvUL2KS.js";const ie=S({__name:"[code]",async setup(Q){let n,u;const{$notify:m}=$(),p=T().params.code,r=_(""),c=_();async function v(){if(await c.value.validate())try{await $fetch("/api/user/recover_password",{method:"POST",body:{recover_code:p,password:r.value}}),m("common.password_updated",w.SUCCESS),E("/login")}catch(o){m(o,w.ERROR)}}const{data:f,error:C}=([n,u]=g(()=>k("/api/user/check_recover_code",{method:"POST",body:{recover_code:p}},"$D-ws6SuY-w")),n=await n,u(),n);return(t,o)=>(i(),V(h,null,{default:e(()=>[a(O,{class:"mt-5",align:"center",justify:"center"},{default:e(()=>[a(D,{cols:"12",md:"6",lg:"5",xl:"4"},{default:e(()=>[a(M,{ref_key:"form",ref:c,onSubmit:B(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(),R(A,{key:0},[a(Y,null,{default:e(()=>[s(l(d(f).email),1)]),_:1}),a(y,null,{default:e(()=>[a(j,{modelValue:d(r),"onUpdate:modelValue":o[0]||(o[0]=b=>F(r)?r.value=b:null),type:"password",label:t.$t("common.new_password"),rules:[t.$valid.password],autofocus:""},null,8,["modelValue","label","rules"])]),_:1}),a(G,null,{default:e(()=>[a(J),a(N,{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(L,{"ma-5":"",type:"error",icon:"mdi-alert"},{default:e(()=>[s(l(t.$t("recover.not_valid_code"))+" ",1),o[1]||(o[1]=x("br",null,null,-1)),s(" "+l(d(C)),1)]),_:1})]),_:1}))]),_:1})]),_:1},512)]),_:1})]),_:1})]),_:1}))}});export{ie as default};
