1 |
- import{d as k,a2 as I,ag as R,a as T,r as U,o as $,K as l,e as i,f as x,j as d,L as u,u as a,y as h,C as g,ac as B,t as _,m as b,i as O}from"./vue-A59npLRR.js";import{c as v,h as q,o as F,_ as K}from"./index-EwE51S_X.js";import{b as w}from"./validate-_EUdkMt3.js";import{F as c}from"./index-r6iTpmP6.js";import"./echarts-cxb9vJr1.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";const S="/admin/OAuthLogin/";function A(){return v({url:S+"changePassword",method:"GET"})}function D(p){return v({url:S+"changePassword",method:"POST",data:p},{showSuccessMessage:!0})}const E={class:"user-views"},M={class:"change-password"},j=k({__name:"oauthChangePassword",setup(p){const{t:o}=I(),C=R(),y=q(),m=T(),e=U({allowSetPassword:!1,formSubmitLoading:!1,form:{oldPassword:"",newPassword:"",confirmPassword:""},rules:{oldPassword:[w({name:"required",title:o("user.account.changePassword.Old password")})],newPassword:[w({name:"required",title:o("user.account.changePassword.New password")}),w({name:"password"})],confirmPassword:[w({name:"required",title:o("user.account.changePassword.Confirm new password")}),w({name:"password"}),{validator:(r,s,t)=>{(e.form.newPassword||e.form.confirmPassword)&&(e.form.newPassword==e.form.confirmPassword?t():t(new Error(o("user.account.changePassword.The duplicate password does not match the new password")))),t()},trigger:"blur"}]}});$(()=>{A().then(r=>{e.allowSetPassword=r.data.allowSetPassword})});const f=r=>{r&&r.validate(s=>{s&&(e.formSubmitLoading=!0,D(e.form).then(t=>{e.formSubmitLoading=!1,t.code==1&&(t.data.allowSetPassword?setTimeout(()=>{C.go(0)},3e3):y.logout())}).catch(()=>{e.formSubmitLoading=!1}))})};return(r,s)=>{const t=l("el-alert"),P=l("el-button"),V=l("el-form-item"),L=l("el-form"),N=l("el-card");return i(),x("div",E,[d(N,{class:"user-views-card",shadow:"hover",header:e.allowSetPassword?a(o)("user.account.changePassword.Set Password"):a(o)("user.account.changePassword.Change Password")},{default:u(()=>[e.allowSetPassword?(i(),h(t,{key:0,class:"set-password-alert",title:a(o)("user.account.changePassword.You do not have a password, please set it first"),type:"info"},null,8,["title"])):g("",!0),O("div",M,[d(L,{model:e.form,rules:e.rules,"label-position":"top",ref_key:"formRef",ref:m,onKeyup:s[5]||(s[5]=B(n=>f(m.value),["enter"]))},{default:u(()=>[e.allowSetPassword?g("",!0):(i(),h(c,{key:0,label:a(o)("user.account.changePassword.Old password"),type:"password",modelValue:e.form.oldPassword,"onUpdate:modelValue":s[0]||(s[0]=n=>e.form.oldPassword=n),prop:"oldPassword","input-attr":{"show-password":!0},placeholder:a(o)("user.account.changePassword.Please enter your current password")},null,8,["label","modelValue","placeholder"])),d(c,{label:a(o)("user.account.changePassword.New password"),type:"password",modelValue:e.form.newPassword,"onUpdate:modelValue":s[1]||(s[1]=n=>e.form.newPassword=n),prop:"newPassword","input-attr":{"show-password":!0},placeholder:a(o)("Please input field",{field:a(o)("user.account.changePassword.New password")})},null,8,["label","modelValue","placeholder"]),d(c,{label:a(o)("user.account.changePassword.Confirm new password"),type:"password",modelValue:e.form.confirmPassword,"onUpdate:modelValue":s[2]||(s[2]=n=>e.form.confirmPassword=n),prop:"confirmPassword","input-attr":{"show-password":!0},placeholder:a(o)("Please input field",{field:a(o)("user.account.changePassword.Confirm new password")})},null,8,["label","modelValue","placeholder"]),d(V,{class:"submit-buttons"},{default:u(()=>[d(P,{onClick:s[3]||(s[3]=n=>a(F)(m.value))},{default:u(()=>[b(_(r.$t("Reset")),1)]),_:1}),d(P,{type:"primary",loading:e.formSubmitLoading,onClick:s[4]||(s[4]=n=>f(m.value))},{default:u(()=>[b(_(r.$t("Save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"])])]),_:1},8,["header"])])}}}),Z=K(j,[["__scopeId","data-v-e720b227"]]);export{Z as default};
|