1import{_ as j}from"./6HuN2jx9.js";import{_ as I}from"./CnIo5AX8.js";import{_ as M}from"./DnMM_Yjt.js";import{u as A,d as E,s as D,g as o,e as p,f as h,h as n,t as i,i as l,l as N,k as L,j as B,E as P,p as T,M as k,r as q}from"./CFxGRstO.js";import{a as _,d as O,c as W,u as z,b as y}from"./CgWzIhW9.js";import{g as G}from"./y6t94vq7.js";import{i as H}from"./Dhu0ts9N.js";import{_ as J}from"./CR0-Au_c.js";import"./DlAUqK2U.js";import"./Cpj98o6Y.js";import"./B2a-ywG8.js";import"./BWBHGvIx.js";import"./-vsEa_js.js";function K(u){const{t}=A(),a={old_password:_(),password:_().required(t("validation.password.required")).min(6,t("validation.password.too_short")).notOneOf([O("old_password")],t("validation.password.must_be_different")).max(32,t("validation.password.too_long")),cpassword:_().oneOf([O("password")],t("validation.password.not_match")).required(t("validation.password.required")).min(6,t("validation.password.too_short")).max(32,t("validation.password.too_long"))};return u.is_auto_password||(a.old_password=_().required(t("validation.password.required")).max(32,t("validation.password.too_long"))),W(a)}const Q={key:0,class:"tw-mx-auto"},X={class:"tw-text-h4 !tw-text-yellow !tw-mb-4 tw-text-center password-form-header"},Y={class:"sign-in-block tw-mx-auto tw-text-center"},Z={class:"tw-mb-4"},oo={key:1,class:"tw-mx-auto"},so={class:"tw-text-h4 !tw-text-yellow !tw-mb-4 tw-text-center password-form-header"},to={class:"sign-in-block tw-mx-auto"},eo={class:"tw-flex tw-flex-col lg:tw-flex-row-reverse tw-gap-2 tw-py-2 tw-my-3"},ao=E({__name:"ChangeForm",props:{backRoute:{}},setup(u){const{t}=A(),a=q(),c=q(!1),{signOut:w,user:$}=D(),{isSubmitting:d,errors:m,handleSubmit:U,setFieldError:b,meta:R}=z({validationSchema:K($)}),{value:f}=y("old_password"),{value:v}=y("password"),{value:g}=y("cpassword"),V=U(async e=>{const s={...e};(await $fetch("/api/account/change-password",{method:"POST",body:s})).success?(a.value="",c.value=!0,await w()):a.value=t("validation.password.incorrect_current")}),S=G();return(e,s)=>{const F=j,x=I,C=M;return o(c)?(p(),h("div",Q,[n("h1",X,i(e.$t("validation.password.has_been_changed")),1),n("div",Y,[n("p",Z,i(e.$t("account.profile.change_password_form.please_sign_in")),1),l(F,{to:"/user/sign-in",class:"btn btn-md btn-primary btn-spinner ripple"},{default:N(()=>[L(i(e.$t("account.profile.change_password_form.proceed_sign_in")),1)]),_:1})])])):(p(),h("div",oo,[n("h1",so,i(o(S)),1),n("div",to,[o(a)?(p(),h("div",{key:0,class:"alert alert-danger",role:"alert",onClick:s[0]||(s[0]=()=>a.value="")},i(o(a)),1)):B("",!0),n("form",{onSubmit:s[8]||(s[8]=P((...r)=>o(V)&&o(V)(...r),["prevent"]))},[o($)?.is_auto_password?B("",!0):(p(),T(x,{key:0,modelValue:o(f),"onUpdate:modelValue":s[1]||(s[1]=r=>k(f)?f.value=r:null),label:e.$t("account.profile.change_password_form.current_password_label"),"error-text":o(m).old_password,"is-disabled":o(d),onFocus:s[2]||(s[2]=()=>o(b)("old_password",""))},null,8,["modelValue","label","error-text","is-disabled"])),l(x,{modelValue:o(v),"onUpdate:modelValue":s[3]||(s[3]=r=>k(v)?v.value=r:null),label:e.$t("account.profile.change_password_form.new_password_label"),"error-text":o(m).password,"is-disabled":o(d),onFocus:s[4]||(s[4]=()=>o(b)("password",""))},null,8,["modelValue","label","error-text","is-disabled"]),l(x,{modelValue:o(g),"onUpdate:modelValue":s[5]||(s[5]=r=>k(g)?g.value=r:null),label:e.$t("account.profile.change_password_form.confirm_password_label"),"error-text":o(m).cpassword,"is-disabled":o(d),onFocus:s[6]||(s[6]=()=>o(b)("cpassword",""))},null,8,["modelValue","label","error-text","is-disabled"]),n("div",eo,[l(C,{label:o(S),class:"btn btn-md btn-primary btn-spinner ripple tw-flex-1",type:"submit",disabled:o(d)||!o(H)(o(m))&&o(R).touched,loading:o(d)},null,8,["label","disabled","loading"]),l(C,{label:e.$t("account.profile.change_password_form.back_to_profile"),class:"btn btn-md btn-outline-primary btn-spinner ripple tw-flex-1",onClick:s[7]||(s[7]=P(r=>e.$router.push(u.backRoute),["prevent"]))},null,8,["label"])])],32)])]))}}}),ro=Object.assign(ao,{__name:"AccountPasswordChangeForm"}),xo=E({__name:"change-password",setup(u){return(t,a)=>{const c=ro,w=J;return p(),T(w,null,{default:N(()=>[l(c,{"back-route":"/account/profile"})]),_:1})}}});
1export{xo as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.