import{v as I,L as V,H as S,f,k as q,j as x,r,o as u,c as m,a as n,w as d,l as i,t as c,b as M,p as N,q as j,g,h as C,i as D}from"./main-B9dpPbRR.js";import{u as F}from"./auth-6FPSPboo.js";const G={key:0},L={key:1},P={class:"mt-4 mb-4 text-sm"},R={__name:"ForgotPassword",setup(A){const $=F(),{t:p}=I.useI18n(),h=V(),s=S({email:"",company:""}),v=f(!1),t=f(!1),y=q(()=>({email:{required:g.withMessage(p("validation.required"),C),email:g.withMessage(p("validation.email_incorrect"),D)}})),e=x(y,s);function B(o){if(e.value.$touch(),e.value.$invalid)return!0;t.value=!0;let a={...s,company:h.params.company};$.forgotPassword(a).then(l=>{t.value=!1}).catch(l=>{t.value=!1}),v.value=!0}return(o,a)=>{const l=r("BaseInput"),b=r("BaseInputGroup"),k=r("BaseButton"),w=r("router-link");return u(),m("form",{id:"loginForm",onSubmit:j(B,["prevent"])},[n(b,{error:i(e).email.$error&&i(e).email.$errors[0].$message,label:o.$t("login.enter_email"),class:"mb-4",required:""},{default:d(()=>[n(l,{modelValue:s.email,"onUpdate:modelValue":a[0]||(a[0]=_=>s.email=_),type:"email",name:"email",invalid:i(e).email.$error,onInput:a[1]||(a[1]=_=>i(e).email.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["error","label"]),n(k,{loading:t.value,disabled:t.value,type:"submit",variant:"primary"},{default:d(()=>[v.value?(u(),m("div",L,c(o.$t("validation.not_yet")),1)):(u(),m("div",G,c(o.$t("validation.send_reset_link")),1))]),_:1},8,["loading","disabled"]),M("div",P,[n(w,{to:"login",class:"text-sm text-primary-400 hover:text-gray-700"},{default:d(()=>[N(c(o.$t("general.back_to_login")),1)]),_:1})])],32)}}};export{R as default};
