import{b as g,u as B,Z as h,r as R,d as E,$ as N,e as s,f as i,k as l,p as c,h as v,m as d,i as t,l as m,j as C,t as P,D as L}from"./app-347ef106.js";import{F as S}from"./Form-893a9a1a.js";/*! 2FAuth version 5.0.3 - Copyright (c) 2023 Bubka - https://github.com/Bubka/2FAuth */const $=["onSubmit"],K={__name:"Reset",setup(x){const n=g();B();const p=h(),u=R(!0),e=E(new S({email:p.query.email,password:"",password_confirmation:"",token:p.query.token}));function f(a){e.password_confirmation=e.password,e.post("/user/password/reset",{returnError:!0}).then(o=>{e.password="",e.password_confirmation="",u.value=!1,n.success({text:o.data.message,duration:-1})}).catch(o=>{o.response.data.resetFailed?n.alert({text:o.response.data.resetFailed,duration:-1}):o.response.status!==422&&n.error(o)})}return N(()=>{n.clear()}),(a,o)=>{const w=s("FormField"),_=s("FormPasswordField"),F=s("FieldError"),k=s("FormButtons"),y=s("RouterLink"),V=s("VueFooter"),b=s("FormWrapper");return i(),l(b,{title:a.$t("auth.forms.new_password")},{default:c(()=>[v("form",{onSubmit:L(f,["prevent"]),onKeydown:o[2]||(o[2]=r=>t(e).onKeydown(r))},[d(w,{modelValue:t(e).email,"onUpdate:modelValue":o[0]||(o[0]=r=>t(e).email=r),isDisabled:!0,fieldName:"email",fieldError:t(e).errors.get("email"),label:"auth.forms.email",autofocus:""},null,8,["modelValue","fieldError"]),d(_,{modelValue:t(e).password,"onUpdate:modelValue":o[1]||(o[1]=r=>t(e).password=r),fieldName:"password",fieldError:t(e).errors.get("password"),autocomplete:"new-password",showRules:!0,label:"auth.forms.new_password"},null,8,["modelValue","fieldError"]),t(e).errors.get("token")!=null?(i(),l(F,{key:0,error:t(e).errors.get("token"),field:t(e).token},null,8,["error","field"])):m("",!0),t(u)?(i(),l(k,{key:1,submitId:"btnResetPwd",isBusy:t(e).isBusy,caption:a.$t("auth.forms.change_password"),showCancelButton:!0,cancelLandingView:"login"},null,8,["isBusy","caption"])):m("",!0),t(u)?m("",!0):(i(),l(y,{key:2,id:"btnContinue",to:{name:"accounts"},class:"button is-link"},{default:c(()=>[C(P(a.$t("commons.continue")),1)]),_:1}))],40,$),d(V)]),_:1},8,["title"])}}};export{K as default};
