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