"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[4557],{54557:(e,s,t)=>{t.r(s),t.d(s,{default:()=>b});var a=t(70314),r=t(36891),o=t(43704),n=t(19601),l=t(86332),m=t.n(l),c=(t(14078),t(61418),t(68581),t(52077),t(83526),t(60042)),i=t.n(c),u=t(84390),d=t.n(u),p=t(72060),f=t(9448),w=t(29925),g=t(23712),h=t(96811);const E=e=>{let{location:s,siteName:t,actions:a}=e;const r=(0,f.useHistory)(),[o,n]=(0,u.useState)(null),l=(0,u.useRef)(null),m=o?d().createElement("div",{className:"form-group has-error"},d().createElement("label",{className:"control-label"},o)):null;return d().createElement("div",{className:"col-sm-12"},d().createElement("div",{className:"signup-team__container"},d().createElement(p.FormattedMessage,{id:"password_form.title",tagName:"h1",defaultMessage:"Password Reset"}),d().createElement("form",{onSubmit:async e=>{e.preventDefault();const t=l.current.value,o=new URLSearchParams(s.search).get("token");if("string"!=typeof o)throw new Error("token must be a string");const{data:m,error:c}=await a.resetUserPassword(o,t);m?(r.push("/login?extra="+g.default.PASSWORD_CHANGE),n(null)):c&&n(c.message)}},d().createElement("p",null,d().createElement(p.FormattedMessage,{id:"password_form.enter",defaultMessage:"Enter a new password for your {siteName} account.",values:{siteName:t}})),d().createElement("div",{className:i()("form-group",{"has-error":o})},d().createElement(w.Z,{id:"resetPasswordInput",type:"password",className:"form-control",name:"password",ref:l,placeholder:{id:(0,h.t)("password_form.pwd"),defaultMessage:"Password"},spellCheck:"false",autoFocus:!0})),m,d().createElement("button",{id:"resetPasswordButton",type:"submit",className:"btn btn-primary"},d().createElement(p.FormattedMessage,{id:"password_form.change",defaultMessage:"Change my password"})))))};E.propTypes={location:m().shape({search:m().string.isRequired}).isRequired,actions:m().shape({resetUserPassword:m().func.isRequired}).isRequired,siteName:m().string};const N=(0,u.memo)(E),b=(0,a.connect)((function(e){return{siteName:(0,n.iE)(e).SiteName}}),(e=>({actions:(0,r.bindActionCreators)({resetUserPassword:o.h8},e)})))(N)}}]);
//# sourceMappingURL=4557.a70c46224a231ba2f029.js.map