import{J as g,X as S,L as T,K as k,P as A,M as N,Y as B,A as p,B as e,C as P,E as n,b as a,a6 as x,a8 as v,S as t,G as m,Q as u,T as F,F as R,V as U,U as E,a4 as w,$ as G,Z as I}from"#entry";import{V as M}from"./gMmVrYwQ.js";import{V as O,a as j}from"./KZF8CoAo.js";import{V as D,a as H,b as J}from"./DlybGOWB.js";import{V as y}from"./DArAxlee.js";import{V as K}from"./tRJ_cXK7.js";import{V as L}from"./C63UuyGC.js";import{V as Q}from"./DSnRMG2T.js";import{V as W}from"./D1vV9CHW.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 ce=g({__name:"[code]",async setup(X){let s,f;const{t:C}=S(),$=T(),h=k("settings");A({title:`${h.value.title} - ${C("common.recover_password")}`});const V=$.params.code,r=w(""),l=w(!1),i=([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 b(){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(P,null,{default:e(()=>[a(M,{modelValue:t(l),"onUpdate:modelValue":d[1]||(d[1]=c=>v(l)?l.value=c:null),onSubmit:x(b,["prevent"])},{default:e(()=>[a(O,{class:"mt-5",align:"center",justify:"center"},{default:e(()=>[a(j,{cols:"12",md:"6",lg:"5",xl:"4"},{default:e(()=>[a(D,null,{default:e(()=>[a(H,null,{default:e(()=>[m(u(o.$t("common.recover_password")),1)]),_:1}),t(i)?(n(),F(R,{key:0},[a(J,null,{default:e(()=>[m(u(t(i).email),1)]),_:1}),a(y,null,{default:e(()=>[a(K,{modelValue:t(r),"onUpdate:modelValue":d[0]||(d[0]=c=>v(r)?r.value=c: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(L,{type:"error",icon:"mdi-alert"},{default:e(()=>[m(u(o.$t("recover.not_valid_code")),1)]),_:1})]),_:1})),a(Q,null,{default:e(()=>[a(W),t(i)?(n(),p(U,{key:0,variant:"outlined",color:"primary",type:"submit",disabled:!t(l)},{default:e(()=>[m(u(o.$t("common.send")),1)]),_:1},8,["disabled"])):E("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}))}});export{ce as default};
