1import{m as n}from"./vendor-CHCIo3bd.js";import{n as i,T as o}from"./app-oVuUJ3MT.js";import"./vendor-filepond-C-Be2LEg.js";/* empty css */const d={components:{TextField:o},data(){return{passwordIndividual:"",passwordBureau:"",isUpdated:null,invalidMessages:[],serverFailure:!1}},computed:{...n({currentUserRole:t=>t.currentUserRole})},methods:{extractMessage(t){return Object.entries(t).map(s=>s.message=s[1].message)},handleChange(t,s){this.isUpdated=null,this.$axios.post(`/api/v1/user/${t}`,{password:s}).then(a=>{this.isUpdated=a.data.passwordChanged,this.invalidMessages=this.extractMessage(a.data.messages),this.isUpdated&&(this.passwordIndividual="",this.passwordBureau="")}).catch(a=>{throw this.serverFailure=!0,new Error(a)})},onSubmitIndividual(){this.handleChange("changePasswordIndividual",this.passwordIndividual)},onSubmitBureau(){this.handleChange("changePasswordBureau",this.passwordBureau)}}};var l=function(){var s=this,a=s._self._c;return a("div",{staticClass:"dashboard__container dashboard__change-password"},[a("h3",{staticClass:"mb-3"},[s._v("Change password")]),s._v(" "),s.isUpdated?a("div",{staticClass:"mb-3"},[a("div",{staticClass:"alert alert--green alert--no-icon mb-3"},[s._v(` 2 Your password has been successfully updated. 3 `)])]):s.serverFailure?a("div",[a("div",{staticClass:"alert alert--red alert--no-icon mb-3"},[s._v(` 4 Changing password failed. Please try again or come back later 5 `)])]):s.invalidMessages.length?a("div",{staticClass:"alert alert--red alert--no-icon mb-3"},s._l(s.invalidMessages,function(e,r){return a("ul",{key:r},[a("li",[s._v(s._s(e))])])}),0):s._e(),s._v(" "),s.currentUserRole.loginType==="individual"?a("form",{staticClass:"mb-5",on:{submit:function(e){return e.preventDefault(),s.onSubmitIndividual()}}},[a("small",[s._v("Password has to be at least 8 characters")]),s._v(" "),a("TextField",{staticClass:"password-input",attrs:{type:"password",placeholder:"Change user password"},model:{value:s.passwordIndividual,callback:function(e){s.passwordIndividual=e},expression:"passwordIndividual"}}),s._v(" "),a("button",{staticClass:"button button--blue"},[s._v("Change password")])],1):s._e(),s._v(" "),s.currentUserRole.bureau&&s.currentUserRole.bureau.id?a("div",[s.currentUserRole.permissions.change_bureau_password?a("form",{on:{submit:function(e){return e.preventDefault(),s.onSubmitBureau()}}},[a("small",[s._v("Password has to be at least 8 characters")]),s._v(" "),a("TextField",{staticClass:"password-input",attrs:{type:"password",placeholder:"Change bureau password"},model:{value:s.passwordBureau,callback:function(e){s.passwordBureau=e},expression:"passwordBureau"}}),s._v(" "),a("button",{staticClass:"button button--blue"},[s._v("Change password")])],1):a("div",[s._v("You don't have permission to change the bureau password")])]):s._e()])},u=[],c=i(d,l,u,!1,null,null);const m=c.exports;export{m 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.