"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[5968],{25968:(e,t,s)=>{s.r(t),s.d(t,{default:()=>g});var a=s(37270),r=s(32446),l=s(17085),n=s(26614),d=s(36418),o=s.n(d),i=s(14778),m=s(14891),c=s(78546),u=s(88153),p=s(98566);class f extends o().PureComponent{state={error:null,updateText:null};resetForm=o().createRef();emailInput=o().createRef();componentDidMount(){const{intl:e,siteName:t}=this.props;document.title=e.formatMessage({id:"password_form.pageTitle",defaultMessage:"Password Reset | {siteName}"},{siteName:t||"Mattermost"})}handleSendLink=async e=>{e.preventDefault();const t=this.emailInput.current.value.trim().toLowerCase();if(!t||!(0,c.xf)(t))return void this.setState({error:o().createElement(i.FormattedMessage,{id:"password_send.error",defaultMessage:"Please enter a valid email address."})});this.setState({error:null});const{data:s,error:a}=await this.props.actions.sendPasswordResetEmail(t);s?(this.setState({error:null,updateText:o().createElement("div",{id:"passwordResetEmailSent",className:"reset-form alert alert-success"},o().createElement(i.FormattedMessage,{id:"password_send.link",defaultMessage:"If the account exists, a password reset email will be sent to:"}),o().createElement("div",null,o().createElement("b",null,t)),o().createElement("br",null),o().createElement(i.FormattedMessage,{id:"password_send.checkInbox",defaultMessage:"Please check your inbox."}))}),this.resetForm.current&&(this.resetForm.current.hidden=!0)):a&&this.setState({error:a.message,updateText:null})};render(){let e=null;this.state.error&&(e=o().createElement("div",{className:"form-group has-error"},o().createElement("label",{className:"control-label"},this.state.error)));let t="form-group";return e&&(t+=" has-error"),o().createElement("div",null,o().createElement(u.A,null),o().createElement("div",{className:"col-sm-12"},o().createElement("div",{className:"signup-team__container"},o().createElement(i.FormattedMessage,{id:"password_send.title",tagName:"h1",defaultMessage:"Password Reset"}),this.state.updateText,o().createElement("form",{onSubmit:this.handleSendLink,ref:this.resetForm},o().createElement("p",null,o().createElement(i.FormattedMessage,{id:"password_send.description",defaultMessage:"To reset your password, enter the email address you used to sign up"})),o().createElement("div",{className:t},o().createElement(p.A,{id:"passwordResetEmailInput",type:"email",name:"email",label:(0,i.defineMessage)({id:"password_send.email",defaultMessage:"Email"}),placeholder:(0,i.defineMessage)({id:"password_send.email.placeholder",defaultMessage:"Enter the email address you used to sign up"}),ref:this.emailInput,spellCheck:"false",autoFocus:!0})),e,o().createElement(m.Button,{id:"passwordResetButton",type:"submit",emphasis:"primary"},o().createElement(i.FormattedMessage,{id:"password_send.reset",defaultMessage:"Reset my password"}))))))}}const h=(0,i.injectIntl)(f),g=(0,a.connect)((function(e){return{siteName:(0,n.zj)(e).SiteName}}),(e=>({actions:(0,r.zH)({sendPasswordResetEmail:l.J1},e)})))(h)},88153:(e,t,s)=>{s.d(t,{A:()=>i});var a=s(71633),r=s.n(a),l=s(36418),n=s.n(l),d=s(14778),o=s(81911);const i=e=>{let{url:t="/",className:s,onClick:a}=e;const{formatMessage:l}=(0,d.useIntl)();return n().createElement("div",{className:r()("signup-header",s)},n().createElement(o.Link,{"data-testid":"back_button",onClick:a,to:t},n().createElement("span",{id:"back_button_icon",className:"fa fa-1x fa-angle-left",title:l({id:"generic_icons.back",defaultMessage:"Back Icon"})}),n().createElement(d.FormattedMessage,{id:"web.header.back",defaultMessage:"Back"})))}}}]);
//# sourceMappingURL=5968.3c9c671aaa8006752b80.js.map