1var u=Object.defineProperty;var w=(t,r,s)=>r in t?u(t,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[r]=s;var h=(t,r,s)=>w(t,typeof r!="symbol"?r+"":r,s);import{ak as c,aa as g,s as n,m as i,r as m,bN as P,j as e,g as a,bt as S,ao as C,a1 as x,bm as M,bn as I}from"./index-qhNauVgs.js";import{C as b}from"./index-DSbFWilC.js";const O=n.div` 2 margin: 0 auto; 3 display: flex; 4 flex-flow: row wrap; 5 6 ${i.desktop` 7 width: 460px; 8 padding: 60px 0px; 9 `}; 10 ${i.tablet` 11 width: 460px; 12 padding: 40px 0px; 13 `}; 14 ${i.mobile` 15 width: calc(100vw - 40px); 16 padding: 30px 0px; 17 `}; 18`,o=n.div` 19 width: 100%; 20 margin-bottom: 15px; 21`,A=n.form` 22 width: 100%; 23 padding: 20px 0px; 24 25 ${i.desktop`margin-bottom: 20px;`}; 26 ${i.tablet`margin-bottom: 20px;`}; 27 ${i.mobile`margin-bottom: 15px;`}; 28`;class E extends m.Component{constructor(s){super(s);h(this,"callChangePasswordApi",()=>{const s=this.props.currentUser.get("id"),p=this.props.currentUser.get("token"),l={oldPassword:this.state.oldPassword,newPassword:this.state.newPassword};new b({userId:s,token:p}).call(l).then(d=>{this.setState({success:!0},()=>this.props.hideLoading())}).catch(d=>{this.setState({errorMessage:this.props.t(d.response.status||"UNKNOWN_ERROR")},()=>this.props.hideLoading())})});this.state={oldPassword:"",newPassword:"",passwordChecksum:"",isOldPasswordValid:!0,isNewPasswordValid:!0,isPasswordChecksumValid:!0,errorMessage:"",success:!1},this.handleInputChange=this.handleInputChange.bind(this),this.onSubmit=this.onSubmit.bind(this)}componentDidMount(){this.props.onChangeState(P,this.props.match.params,this.props.match.url),this.props.isLoggedIn||this.props.history.push("/sign-in")}componentWillUnmount(){this.props.hideLoading()}handleInputChange(s){this.setState({[s.target.name]:s.target.value})}validatePassword(){return this.state.oldPassword?this.state.newPassword?this.state.newPassword!==this.state.passwordChecksum?(this.setState({isPasswordChecksumValid:!1,errorMessage:this.props.t("INVALID_PASSWORD_CHECKSUM")}),!1):!0:(this.setState({isNewPasswordValid:!1,errorMessage:this.props.t("INVALID_PASSWORD")}),!1):(this.setState({isOldPasswordValid:!1,errorMessage:this.props.t("INVALID_PASSWORD")}),!1)}get isValid(){return this.validatePassword()}onSubmit(s){this.setState({isOldPasswordValid:!0,isNewPasswordValid:!0,isPasswordChecksumValid:!0,errorMessage:""},()=>{this.isValid&&(this.props.showLoading(),this.callChangePasswordApi())}),s.preventDefault()}renderErrorMessage(){return e.jsx(o,{children:e.jsx(a.ErrorMessage,{children:this.state.errorMessage})})}renderSuccessMessage(){return e.jsx(o,{children:e.jsx(a.SuccessMessage,{children:this.props.t("SUCCESS")})})}renderMessage(){if(this.state.errorMessage)return this.renderErrorMessage();if(this.state.success)return this.renderSuccessMessage()}render(){const s=this.state.oldPassword&&this.state.newPassword&&this.state.passwordChecksum;return e.jsxs(O,{children:[e.jsx(S.Title,{titleText:this.props.t("MAIN_TITLE")}),e.jsxs(A,{onSubmit:this.onSubmit,children:[e.jsx(o,{children:e.jsx(a.SquareInput,{id:"password",name:"oldPassword",word:this.props.t("OLD_PASSWORD"),type:"password",onChange:this.handleInputChange,placeholder:this.props.t("OLD_PASSWORD_PLACEHOLDER"),error:!this.state.isOldPasswordValid,errorMessage:this.state.errorMessage,showErrorMessage:!this.state.isOldPasswordValid&&this.state.errorMessage,autoComplete:"current-password",eye:!0,autoFocus:!0})}),e.jsx(o,{children:e.jsx(a.SquareInput,{id:"newPassword",name:"newPassword",word:this.props.t("NEW_PASSWORD"),type:"password",onChange:this.handleInputChange,placeholder:this.props.t("NEW_PASSWORD_PLACEHOLDER"),error:!this.state.isNewPasswordValid,errorMessage:this.state.errorMessage,showErrorMessage:!this.state.isNewPasswordValid&&this.state.errorMessage,autoComplete:"new-password",eye:!0})}),e.jsx(o,{children:e.jsx(a.SquareInput,{id:"passwordChecksum",name:"passwordChecksum",word:this.props.t("CONFIRM_PASSWORD"),type:"password",onChange:this.handleInputChange,placeholder:this.props.t("PASSWORD_CHECKSUM_PLACEHOLDER"),error:!this.state.isPasswordChecksumValid,errorMessage:this.state.errorMessage,showErrorMessage:!this.state.isPasswordChecksumValid&&this.state.errorMessage,autoComplete:"new-password",eye:!0})}),e.jsx(o,{children:e.jsx(a.Button,{onClick:this.onSubmit,backgroundColor:s?"#008159":"#656565",backgroundColorHover:s&&"#00a270",children:this.props.t("CONFIRM")})}),this.renderMessage()]})]})}}const f=t=>({currentUser:t.getIn(["user","current"]),isLoggedIn:t.getIn(["authentication","isLoggedIn"])}),D=t=>C({onChangeState:x,showLoading:M,hideLoading:I},t),k=c(f,D)(g("ChangePassword")(E));export{k 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.