1"use strict";(self.webpackChunkUserPanel_MoST=self.webpackChunkUserPanel_MoST||[]).push([[7910],{7910:function(e,s,r){r.r(s),r.d(s,{default:function(){return P}});var a=r(29439),n=r(99295),t=r(29867),i=r(84670),o=r(48743),l=r(43576),u=r(51383),d=r(86283),m=r(74165),c=r(15861),h=r(27293),p=r(63663),w=r(86934),f=r(50383),g=r(3706),x=r(11912),b=r(41167),_={old_password:[{required:!0,message:"Please input your current password"},{min:6,message:"Password no less than 6"}],new_password:[{required:!0,message:"Please input your new password!"},{min:6,message:"Password no less than 6"}],new_password_confirmation:[{required:!0,message:"Please input your confirm new password!"},{min:6,message:"Password no less than 6"}]},Z=r(92834),j=function(e){var s,r,n=(0,h.J)().t,i=e.formRef,o=e.loading,l=e.initialValues,u=e.isSubmitting,d=e.handleChange,j=e.handleSubmit,v=e.handleSubmitFailed,P=(0,t.useState)(!1),y=(0,a.Z)(P,2),S=y[0],F=y[1],k=function(e,r,a){return(s=s||(0,c.Z)((0,m.Z)().mark((function e(s,r,a){var n;return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,void 0==r||""==r){e.next=8;break}if(n.test(r.trim())){e.next=6;break}return e.abrupt("return",Promise.reject("Provide valid Email!"));case 6:if(!(r.trim().length>64)){e.next=8;break}return e.abrupt("return",Promise.reject("Maximum character is 64!"));case 8:return e.abrupt("return",Promise.resolve());case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)};return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("h1",{children:n("Edit Account")}),(0,Z.jsx)(p.Z,{gutter:[16,16],children:(0,Z.jsx)(w.Z,{span:"10",children:(0,Z.jsxs)(f.Z,{form:i,name:"changePasswordForm",scrollToFirstError:!0,initialValues:l,onValuesChange:d,onFinish:j,onFinishFailed:v,layout:"vertical",children:[(0,Z.jsx)(f.Z.Item,{label:n("Username"),name:"name",rules:[{required:!0,message:"Please input your user name"}],children:(0,Z.jsx)(g.Z,{type:"text"})}),(0,Z.jsx)(f.Z.Item,{name:"email",rules:[{required:!0,message:"Please input your email"},{validator:function(e,s){return(r=r||(0,c.Z)((0,m.Z)().mark((function e(s,r){return(0,m.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",k(s,r,"email"));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}}],label:n("Email Address"),children:(0,Z.jsx)(g.Z,{})}),(0,Z.jsx)(f.Z.Item,{name:"is_password_changed",valuePropName:"checked",children:(0,Z.jsx)(x.Z,{value:!0,onChange:function(e){return s=e.target.checked,void F(s);var s},children:n("Do you want to change password?")})}),S?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(f.Z.Item,{label:n("Current password"),name:"old_password",rules:_.old_password,children:(0,Z.jsx)(g.Z,{type:"text"})}),(0,Z.jsx)(f.Z.Item,{label:n("New password"),name:"new_password",rules:_.new_password,children:(0,Z.jsx)(g.Z,{type:"text"})}),(0,Z.jsx)(f.Z.Item,{label:n("Confirm new Password"),name:"new_password_confirmation",rules:[{required:!0,message:"Please input your confirm new password!"},{min:6,message:"Password no less than 6"},function(e){var s=e.getFieldValue;return{validator:function(e,r){return r&&s("new_password")!==r?Promise.reject("The password confirmation does not match"):Promise.resolve()}}}],children:(0,Z.jsx)(g.Z,{type:"text"})})]}):null,(0,Z.jsx)("div",{className:"row-admin-login admin-login-submit-btn",children:(0,Z.jsx)(b.Z,{type:"primary",htmlType:"submit",className:"submit-loading-button",disabled:u,loading:o,children:"Update"})})]})})})]})},v=t.memo(j),P=function(){var e=(0,i.s0)(),s=(0,t.useState)(!1),r=(0,a.Z)(s,2),m=r[0],c=(r[1],(0,u.c)({})),h=c.formRef,p=c.initialValues,w=c.setErrors,f=c.isSubmitting,g=c.setIsSubmitting,x=c.handleChange,b=c.handleSubmitFailed,_=(0,d.r)(),j=(_.isLoading,_.showLoading),P=_.hideLoading,y=(0,n.U)(),S=y.handleErrorMessage,F=y.handleSuccessMessage,k=(y.showErrorMessage,(0,t.useContext)(l.Vo)),C=k.userId,E=k.userName,I=k.userEmail,V=k.setUserInfo;(0,t.useEffect)((function(){C&&h.setFieldsValue({name:E,email:I})}),[C]);return(0,Z.jsx)(v,{formRef:h,loading:m,initialValues:p,isSubmitting:f,handleChange:x,handleSubmit:function(s){j(),g(!0);
1var r={name:s.name,email:s.email,is_password_changed:s.is_password_changed,old_password:s.old_password,new_password:s.new_password,new_password_confirmation:s.new_password_confirmation};o.MfR.updateAccount(r).then((function(r){F(r),P(),g(!1),V(s.name,s.email),e("/")})).catch((function(e){S(e,w),P(),g(!1)}))},handleSubmitFailed:b})}}}]); 2//# sourceMappingURL=7910.34593a73.chunk.js.map
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.