1import{aO as f,aR as i,aS as s,bf as r,aX as c,bd as b,b6 as g,aN as d,aP as m,bh as y,aQ as S}from"./DGfe1mPV.js";import{_ as p}from"./kbZ6rl6-.js";import{_ as n}from"./DsRRN0kT.js";import{_ as l}from"./BK5ZpevN.js";import{h as _}from"./Cx27IZB1.js";import{I as u}from"./bb2v1qCj.js";import{_ as h}from"./D4377EAA.js";import{o as w}from"./DvQhDk2D.js";import"./v33dYHEJ.js";import"./CYV-VOaX.js";import"./DRnbzGmH.js";import"./D3MjPVNK.js";import"./DItGyk5J.js";import"./CJdqWCHh.js";import"./BFzNBh79.js";import"./CFFffhLo.js";import"./DVU4-FXT.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};a.SENTRY_RELEASE={id:"[email protected]"};var e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="1193417c-9ed1-4ba6-89b8-07e974f07e2a",a._sentryDebugIdIdentifier="sentry-dbid-1193417c-9ed1-4ba6-89b8-07e974f07e2a")}catch{}})();const C={mixins:[w],components:{InnerPagesTitle:u,FormInput:l,FormBlock:n,Block:p,OtpVerificationModal:h},head(){return _.noIndex("Profile",null,this.getCanonicalUrl())},data(){return{authStore:g(),errors:{},notUser:!1,data:{email:"",email_confirmation:"",username:"",role:"user"}}},mounted(){b().$axios.get("user/settings/email").then(({data:e})=>{this.notUser=e.role!=="user",this.data=e}).catch(()=>{})},computed:{otpConfig(){return{actionType:"user_email_change",validateEndpoint:"user/settings/email/validate",submitEndpoint:"user/settings/email"}}},methods:{async handleFormSubmit(){this.errors={};try{await this.validateFormOnServer(),await this.startOtpVerification()}catch{}},async validateFormOnServer(){try{if((await this.$axios.post(this.otpConfig.validateEndpoint,this.data)).data.success)return!0}catch(a){throw this.errorValidation(a,this.errors),a}},async handleOtpSuccess(a){this.showOtpModal=!1,this.cleanupOtpPolling(),await this.saveEmail()},async saveEmail(){try{await this.$axios.post(this.otpConfig.submitEndpoint,this.data),this.clearEmailConfirmation(),this.$toast.success("Your email has been updated successfully"),this.errors={},this.authStore.updateUserData({username:this.data.username,email:this.data.email})}catch(a){this.errorValidation(a,this.errors)}},clearEmailConfirmation(){this.data&&(this.data.email_confirmation="")}}},Y=Object.assign(C,{__name:"email",setup(a){return(e,t)=>(d(),f("section",null,[i(u,{"back-path":"/account/settings","back-text":"Settings",title:"Email address"}),i(r(p),null,{default:s(()=>[m("form",{id:"email",onSubmit:t[2]||(t[2]=y((...o)=>e.handleFormSubmit&&e.handleFormSubmit(...o),["prevent"]))},[i(r(n),{label:e.$t("global.email_address")},{default:s(()=>[i(r(l),{modelValue:e.data.email,"onUpdate:modelValue":t[0]||(t[0]=o=>e.data.email=o),init:e.data.email,error:e.errors.email,placeholder:e.$t("global.email_address"),type:"email"},null,8,["modelValue","init","error","placeholder"])]),_:1},8,["label"]),i(r(n),{label:e.$t("settings.profile.confirm_email")},{default:s(()=>[i(r(l),{modelValue:e.data.email_confirmation,"onUpdate:modelValue":t[1]||(t[1]=o=>e.data.email_confirmation=o),error:e.errors.email_confirmation,placeholder:e.$t("settings.profile.confirm_email"),type:"email"},null,8,["modelValue","error","placeholder"])]),_:1},8,["label"])],32),m("button",{class:"btn full color set-bg mt-20px",onClick:t[3]||(t[3]=(...o)=>e.handleFormSubmit&&e.handleFormSubmit(...o))},S(e.$t("global.save")),1)]),_:1}),(d(),c(h,{key:e.otpModalKey,ref:"otpModal",show:e.showOtpModal,"action-type":e.otpConfig.actionType,onOtpSuccess:e.handleOtpSuccess,onCloseModal:e.handleOtpCancel,onDeliveryMethodChanged:e.handleDeliveryMethodChanged,onPasskeyCancelled:e.handlePasskeyCancelled},null,8,["show","action-type","onOtpSuccess","onCloseModal","onDeliveryMethodChanged","onPasskeyCancelled"]))]))}});export{Y 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.