"use strict";(self["webpackChunksortinghat_ui"]=self["webpackChunksortinghat_ui"]||[]).push([[858],{44858:(e,r,s)=>{s.r(r),s.d(r,{default:()=>k});s(62062),s(18111),s(61701),s(26099);var o=s(20641),n=s(53751),a=s(31969),t=s(13892),d=s(4189),u=s(91606),l=s(30697),i=s(1560),c=s(98477),w=s(43948),p={key:0,class:"mb-8"};function m(e,r,s,m,_,f){return(0,o.uX)(),(0,o.Wv)(c.Y,null,{default:(0,o.k6)((function(){return[(0,o.bF)(d.J,{class:"mx-auto mt-6 section","max-width":"500",elevation:"0",outlined:""},{default:(0,o.k6)((function(){return[(0,o.bF)(u.r,{class:"header"},{default:(0,o.k6)((function(){return r[3]||(r[3]=[(0,o.eW)("Password change")])})),_:1}),(0,o.bF)(l.O,{class:"pa-8"},{default:(0,o.k6)((function(){return[e.showForm?((0,o.uX)(),(0,o.CE)("p",p," Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly. ")):(0,o.Q3)("",!0),e.showForm?((0,o.uX)(),(0,o.Wv)(i.n,{key:1,ref:"form_change_password"},{default:(0,o.k6)((function(){return[(0,o.bF)(w.W,{modelValue:e.old_password,"onUpdate:modelValue":r[0]||(r[0]=function(r){return e.old_password=r}),label:"Old password",name:"old_password",type:"password","error-count":"5",class:"mb-4","error-messages":e.errors.old_password?e.errors.old_password.map((function(e){return e.message})):[],outlined:"",dense:""},null,8,["modelValue","error-messages"]),(0,o.bF)(w.W,{modelValue:e.new_password1,"onUpdate:modelValue":r[1]||(r[1]=function(r){return e.new_password1=r}),label:"New password",name:"new_password1",type:"password","error-count":"5",class:"mb-4","error-messages":e.errors.new_password1?e.errors.new_password1.map((function(e){return e.message})):[],outlined:"",dense:""},null,8,["modelValue","error-messages"]),(0,o.bF)(w.W,{modelValue:e.new_password2,"onUpdate:modelValue":r[2]||(r[2]=function(r){return e.new_password2=r}),label:"New password confirmation",name:"new_password2",type:"password","error-count":"5",class:"mb-4","error-messages":e.errors.new_password2?e.errors.new_password2.map((function(e){return e.message})):[],outlined:"",dense:""},null,8,["modelValue","error-messages"]),(0,o.bF)(t.D,{disabled:!e.old_password||!e.new_password1||!e.new_password2,color:"primary",variant:"flat",size:"default",onClick:(0,n.D$)(f.onSubmit,["prevent"])},{default:(0,o.k6)((function(){return r[4]||(r[4]=[(0,o.eW)(" Save ")])})),_:1},8,["disabled","onClick"])]})),_:1},512)):((0,o.uX)(),(0,o.Wv)(a.l,{key:2,outlined:"",type:"success",text:""},{default:(0,o.k6)((function(){return r[5]||(r[5]=[(0,o.eW)(" Password changed successfully ")])})),_:1}))]})),_:1})]})),_:1})]})),_:1})}s(28706),s(27495),s(47764),s(25440),s(62953),s(3296),s(27208),s(48408),s(14603),s(47566),s(98721);var _=s(12215),f=s.n(_);const h={name:"ChangePassword",data:function(){return{old_password:"",new_password1:"",new_password2:"",errors:{},showForm:!0}},computed:{url:function(){var e="/password_change/",r="/identities/".replace(/\/$/,"");return{NODE_ENV:"production",BASE_URL:"/identities/"}.VUE_APP_API_URL&&(r=new URL({NODE_ENV:"production",BASE_URL:"/identities/"}.VUE_APP_API_URL).origin.replace(/\/$/,"")),"".concat(r).concat(e)},headers:function(){var e=f().get("csrftoken"),r={"X-CSRFToken":e};return r}},methods:{onSubmit:function(){var e=this,r=this.$refs.form_change_password.$el,s=new FormData(r);this.errors={},fetch(this.url,{method:"POST",credentials:"include",headers:this.headers,body:s}).then((function(e){return e.json()})).then((function(r){r.errors?(e.errors=r.errors,e.$logger.error("Error changing password",r)):(e.showForm=!1,e.$logger.info("Changed password for user ".concat(r.updated)))}))}}};var g=s(64621);const b=(0,g.A)(h,[["render",m]]),k=b}}]);
//# sourceMappingURL=858.86e57295.js.map