"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[7099],{47099:(e,s,t)=>{t.r(s),t.d(s,{default:()=>N});var a=t(37270),r=t(32446),o=t(17085),n=t(26614),l=t(62688),m=t.n(l),c=(t(17046),t(43813),t(36169),t(3188),t(30973),t(71633)),i=t.n(c),u=t(36418),d=t.n(u),p=t(14778),f=t(81911),w=t(78451);const g=e=>{let{location:s,siteName:t,actions:a}=e;const r=(0,p.useIntl)(),o=(0,f.useHistory)(),[n,l]=(0,u.useState)(null),m=(0,u.useRef)(null);(0,u.useEffect)((()=>{document.title=r.formatMessage({id:"password_form.pageTitle",defaultMessage:"Password Reset | {siteName}"},{siteName:t||"Mattermost"})}),[r,t]);const c=n?d().createElement("div",{className:"form-group has-error"},d().createElement("label",{className:"control-label"},n)):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=m.current.value,r=new URLSearchParams(s.search).get("token");if("string"!=typeof r)throw new Error("token must be a string");const{data:n,error:c}=await a.resetUserPassword(r,t);n?(o.push("/login?extra="+w.Ay.PASSWORD_CHANGE),l(null)):c&&l(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":n})},d().createElement("input",{id:"resetPasswordInput",type:"password",className:"form-control",name:"password",ref:m,placeholder:r.formatMessage({id:"password_form.pwd",defaultMessage:"Password"}),spellCheck:"false",autoFocus:!0})),c,d().createElement("button",{id:"resetPasswordButton",type:"submit",className:"btn btn-primary"},d().createElement(p.FormattedMessage,{id:"password_form.change",defaultMessage:"Change my password"})))))};g.propTypes={location:m().shape({search:m().string.isRequired}).isRequired,actions:m().shape({resetUserPassword:m().func.isRequired}).isRequired,siteName:m().string};const h=(0,u.memo)(g),N=(0,a.connect)((function(e){return{siteName:(0,n.zj)(e).SiteName}}),(e=>({actions:(0,r.zH)({resetUserPassword:o.cw},e)})))(h)}}]);
//# sourceMappingURL=7099.58ad1d8a91a7e5a6d707.js.map