(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[109],{6109:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>P});var r=t(14890),a=t(37703),o=t(78781),n=t(12543),l=(t(88674),t(64765),t(33948),t(60285),t(45697)),c=t.n(l),i=t(67294),d=t(44012),m=t(89262),u=t(78274),p=t(927),h=t(82251);function w(e,s,t){return s in e?Object.defineProperty(e,s,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[s]=t,e}class f extends i.PureComponent{constructor(e){super(e),w(this,"handlePasswordReset",(async e=>{e.preventDefault();const s=this.passwordInput.current.value;if(!s||s.length<u.ZP.MIN_PASSWORD_LENGTH)return void this.setState({error:i.createElement(d.Z,{id:"password_form.error",defaultMessage:"Please enter at least {chars} characters.",values:{chars:u.ZP.MIN_PASSWORD_LENGTH}})});this.setState({error:null});const t=new URLSearchParams(this.props.location.search).get("token"),{data:r,error:a}=await this.props.actions.resetUserPassword(t,s);r?(m.m.push("/login?extra="+u.ZP.PASSWORD_CHANGE),this.setState({error:null})):a&&this.setState({error:a.message})})),this.state={error:null},this.passwordInput=i.createRef()}render(){let e=null;this.state.error&&(e=i.createElement("div",{className:"form-group has-error"},i.createElement("label",{className:"control-label"},this.state.error)));let s="form-group";return e&&(s+=" has-error"),i.createElement("div",{className:"col-sm-12"},i.createElement("div",{className:"signup-team__container"},i.createElement("h3",null,i.createElement(d.Z,{id:"password_form.title",defaultMessage:"Password Reset"})),i.createElement("form",{onSubmit:this.handlePasswordReset},i.createElement("p",null,i.createElement(d.Z,{id:"password_form.enter",defaultMessage:"Enter a new password for your {siteName} account.",values:{siteName:this.props.siteName}})),i.createElement("div",{className:s},i.createElement(p.Z,{id:"resetPasswordInput",type:"password",className:"form-control",name:"password",ref:this.passwordInput,placeholder:{id:(0,h.t)("password_form.pwd"),defaultMessage:"Password"},spellCheck:"false",autoFocus:!0})),e,i.createElement("button",{id:"resetPasswordButton",type:"submit",className:"btn btn-primary"},i.createElement(d.Z,{id:"password_form.change",defaultMessage:"Change my password"})))))}}w(f,"propTypes",{location:c().object.isRequired,siteName:c().string,actions:c().shape({resetUserPassword:c().func.isRequired}).isRequired});const P=(0,a.connect)((e=>{const{SiteName:s}=(0,o.getConfig)(e);return{siteName:s}}),(e=>({actions:(0,r.bindActionCreators)({resetUserPassword:n.resetUserPassword},e)})))(f)}}]);
//# sourceMappingURL=109.a8a735a795a46556bfa0.js.map