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