import{b as B,u as b,$ as R,r as h,d as E,a1 as N,e as s,f as i,k as l,p as c,h as C,m as d,i as t,l as m,j as v,t as P,C as L}from"./app-BsP-5XS6.js";import{F as $}from"./Form-BkUnzt6c.js";/*! 2FAuth version 5.2.0 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const D={__name:"Reset",setup(x){const a=B();b();const p=R(),u=h(!0),e=E(new $({email:p.query.email,password:"",password_confirmation:"",token:p.query.token}));function f(n){e.password_confirmation=e.password,e.post("/user/password/reset",{returnError:!0}).then(o=>{e.password="",e.password_confirmation="",u.value=!1,a.success({text:o.data.message,duration:-1})}).catch(o=>{o.response.data.resetFailed?a.alert({text:o.response.data.resetFailed,duration:-1}):o.response.status!==422&&a.error(o)})}return N(()=>{a.clear()}),(n,o)=>{const w=s("FormField"),_=s("FormPasswordField"),F=s("FieldError"),k=s("FormButtons"),y=s("RouterLink"),V=s("VueFooter"),g=s("FormWrapper");return i(),l(g,{title:n.$t("auth.forms.new_password")},{default:c(()=>[C("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:n.$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(()=>[v(P(n.$t("commons.continue")),1)]),_:1}))],32),d(V)]),_:1},8,["title"])}}};export{D as default};
