import{M as z,$ as F,av as L,aC as Q,au as O,c6 as H,at as W,aw as M,r as j,E as b,U as f,N as p,O as o,X as l,W as V,e,az as U,R as q,a8 as X,P as y,Q as Y,V as w,Z as $,Y as r,ab as Z}from"./vendor-CsGITfgk.js";import{a4 as G,at as J,f as K,ai as x,bN as I}from"./index-CsCqMgta.js";import{u as ee,_ as se}from"./password-tips.vue_vue_type_script_setup_true_lang-DOZf-5Mk.js";const oe=z({__name:"reset-password-form",props:{userId:{},token:{},mode:{default:"reset"}},emits:["succeeded"],setup(C,{emit:S}){const R=S,a=C,{t:h}=F(),{resetPassword:k,loading:_}=G(),{passwordRequirements:d}=ee(),{translate:u}=J("identity_error"),B=L(Q({password:O().required(),confirmPassword:O().required().oneOf([H("password")],h("common.messages.passwords_do_not_match"))})),{errors:m,meta:s,handleSubmit:P}=W({validationSchema:B,initialValues:{password:"",confirmPassword:""},validateOnMount:!1}),{value:g}=M("password"),{value:c}=M("confirmPassword"),v=j(),N=b(()=>a.mode==="reset"),T=P(async n=>{v.value=await k({userId:a.userId,token:a.token,password:`${n.password}`}),v.value.succeeded&&R("succeeded")});return(n,i)=>{const E=f("VcInput"),A=f("VcAlert"),D=f("VcButton");return o(),p("form",{class:"text-start",onSubmit:i[2]||(i[2]=(...t)=>e(T)&&e(T)(...t))},[l(E,{modelValue:e(g),"onUpdate:modelValue":i[0]||(i[0]=t=>U(g)?g.value=t:null),class:"mb-4 w-full",label:n.$t("common.labels.password"),placeholder:n.$t("common.placeholders.password"),type:"password",required:"",message:e(m).password,error:!!e(m).password,autocomplete:"new-password",maxlength:64},null,8,["modelValue","label","placeholder","message","error"]),l(E,{modelValue:e(c),"onUpdate:modelValue":i[1]||(i[1]=t=>U(c)?c.value=t:null),class:"mb-4 w-full",label:n.$t("common.labels.confirm_password"),placeholder:n.$t("common.placeholders.confirm_password"),type:"password",required:"",message:e(m).confirmPassword,error:!!e(m).confirmPassword,autocomplete:"off",maxlength:64},null,8,["modelValue","label","placeholder","message","error"]),V("div",null,[e(d)?(o(),q(se,{key:0,requirements:e(d)},null,8,["requirements"])):X("",!0),(o(!0),p(y,null,Y(v.value?.errors,t=>(o(),q(A,{key:t.code,class:"my-5 text-xs",color:"danger",size:"sm",variant:"solid-light",icon:""},{default:w(()=>[$(r(e(u)(t)),1)]),_:2},1024))),128)),l(D,{type:"submit",class:"mt-6 w-full lg:w-52",loading:e(_),disabled:!e(s).valid||e(s).pending},{default:w(()=>[$(r(n.$t(N.value?"common.buttons.reset_password":"common.buttons.save")),1)]),_:1},8,["loading","disabled"])])],32)}}}),ae={class:"w-full sm:pe-12 md:pe-24"},te={class:"mb-4 text-base font-bold"},re={class:"mb-3 text-base sm:mb-6"},ne={class:"mb-3 text-base font-bold text-danger sm:mb-6"},me=z({__name:"reset-password",setup(C){const S=Z(),{t:R}=F();K({title:R("pages.reset_password.meta.title")});const a=j(!1),h=x("userId"),k=x("token"),_=b(()=>!!(h.value&&k.value)),d=b(()=>S.name==="ResetPassword"),u=b(()=>d.value?"reset_password":"set_password"),B=b(()=>_.value?a.value?I.success:I.secondary:I.danger);function m(){a.value=!0,window.scroll(0,0)}return(s,P)=>{const g=f("VcTypography"),c=f("VcButton"),v=f("VcEmptyPage");return o(),q(v,{icon:"outline-security",image:d.value?"sign-in.jpg":"reg.jpg","status-color":B.value,"hide-mobile-side":_.value&&!a.value},{default:w(()=>[V("div",ae,[l(g,{tag:"h1",class:"order-first mb-3"},{default:w(()=>[$(r(s.$t(`pages.${u.value}.header`)),1)]),_:1}),_.value?(o(),p(y,{key:0},[a.value?(o(),p(y,{key:1},[V("div",re,r(s.$t(`pages.${u.value}.success_message`)),1),l(c,{to:{name:"SignIn"},"min-width":"12rem"},{default:w(()=>[$(r(s.$t(`pages.${u.value}.log_in_button`)),1)]),_:1})],64)):(o(),p(y,{key:0},[V("div",te,r(s.$t(`pages.${u.value}.enter_new_password_message`)),1),l(e(oe),{"user-id":e(h),token:e(k),mode:d.value?"reset":"set",class:"w-full",onSucceeded:P[0]||(P[0]=N=>m())},null,8,["user-id","token","mode"])],64))],64)):(o(),p(y,{key:1},[V("div",ne,r(s.$t("common.messages.invalid_user_id_or_token")),1),l(c,{to:"/","min-width":"12rem"},{default:w(()=>[$(r(s.$t("common.buttons.home")),1)]),_:1})],64))])]),_:1},8,["image","status-color","hide-mobile-side"])}}});export{me as default};
//# sourceMappingURL=reset-password-DLlPw8H-.js.map
