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