import{J as q,G as I,aN as h,a0 as N,B as S,k as d,M as w,Q as k,N as L,P,T as U,r as f,o as A,e as C,f as n,w as m,u as r,i as E,t as G,U as j,a as D}from"./vendor.d12b5734.js";import{u as M,h as R}from"./main.465728e1.js";const T=["onSubmit"],Q={setup(x){const v=M(),{t}=q(),c=I(),$=h(),o=N({email:"",password:"",password_confirmation:""}),u=S(!1),_=d(()=>({email:{required:w,email:k},password:{required:w,minLength:L(8)},password_confirmation:{sameAsPassword:P(o.password)}})),a=U(_,o),g=d(()=>a.value.email.$error?a.value.email.required.$invalid?t("validation.required"):a.value.email.email?t("validation.email_incorrect"):!1:""),b=d(()=>a.value.password.$error?a.value.password.required.$invalid?t("validation.required"):a.value.password.minLength?t("validation.password_min_length",{count:a.value.password.minLength.$params.min}):!1:""),V=d(()=>a.value.password_confirmation.$error?a.value.password_confirmation.sameAsPassword.$invalid?t("validation.password_incorrect"):!1:"");async function y(i){if(a.value.$touch(),!a.value.$invalid)try{let e={email:o.email,password:o.password,password_confirmation:o.password_confirmation,token:c.params.token};u.value=!0;let l=await D.post("/api/v1/auth/reset/password",e);u.value=!1,l.data&&(v.showNotification({type:"success",message:t("login.password_reset_successfully")}),$.push("/login"))}catch(e){R(e),u.value=!1,e.response&&e.response.status===403}}return(i,e)=>{const l=f("BaseInput"),p=f("BaseInputGroup"),B=f("BaseButton");return A(),C("form",{id:"loginForm",onSubmit:j(y,["prevent"])},[n(p,{error:r(g),label:i.$t("login.email"),class:"mb-4",required:""},{default:m(()=>[n(l,{modelValue:r(o).email,"onUpdate:modelValue":e[0]||(e[0]=s=>r(o).email=s),invalid:r(a).email.$error,focus:"",type:"email",name:"email",onInput:e[1]||(e[1]=s=>r(a).email.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["error","label"]),n(p,{error:r(b),label:i.$t("login.password"),class:"mb-4",required:""},{default:m(()=>[n(l,{modelValue:r(o).password,"onUpdate:modelValue":e[2]||(e[2]=s=>r(o).password=s),invalid:r(a).password.$error,type:"password",name:"password",onInput:e[3]||(e[3]=s=>r(a).password.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["error","label"]),n(p,{error:r(V),label:i.$t("login.retype_password"),class:"mb-4",required:""},{default:m(()=>[n(l,{modelValue:r(o).password_confirmation,"onUpdate:modelValue":e[4]||(e[4]=s=>r(o).password_confirmation=s),invalid:r(a).password_confirmation.$error,type:"password",name:"password",onInput:e[5]||(e[5]=s=>r(a).password_confirmation.$touch())},null,8,["modelValue","invalid"])]),_:1},8,["error","label"]),n(B,{loading:u.value,type:"submit",variant:"primary"},{default:m(()=>[E(G(i.$t("login.reset_password")),1)]),_:1},8,["loading"])],40,T)}}};export{Q as default};
