"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[5968],{88153:(e,t,s)=>{s.d(t,{A:()=>u});var a=s(62688),r=s.n(a),n=s(71633),l=s.n(n),i=s(97023),o=s.n(i),d=s(14778),c=s(81911);const m=e=>{let{url:t,className:s,onClick:a}=e;const{formatMessage:r}=(0,d.useIntl)();return o().createElement("div",{className:l()("signup-header",s)},o().createElement(c.Link,{"data-testid":"back_button",onClick:a,to:t},o().createElement("span",{id:"back_button_icon",className:"fa fa-1x fa-angle-left",title:r({id:"generic_icons.back",defaultMessage:"Back Icon"})}),o().createElement(d.FormattedMessage,{id:"web.header.back",defaultMessage:"Back"})))};m.propTypes={url:r().string,className:r().string,onClick:r().func},m.defaultProps={url:"/"};const u=m},25968:(e,t,s)=>{s.r(t),s.d(t,{default:()=>E});var a=s(23453),r=s(5908),n=s(17085),l=s(26614),i=s(62688),o=s.n(i),d=(s(17046),s(43813),s(76685),s(4290),s(97023)),c=s.n(d),m=s(14778),u=s(78546),p=s(88153),f=s(98566);function h(e,t,s){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class g extends c().PureComponent{constructor(){super(...arguments),h(this,"state",{error:null,updateText:null}),h(this,"resetForm",c().createRef()),h(this,"emailInput",c().createRef()),h(this,"handleSendLink",(async e=>{e.preventDefault();const t=this.emailInput.current.value.trim().toLowerCase();if(!t||!(0,u.xf)(t))return void this.setState({error:c().createElement(m.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:c().createElement("div",{id:"passwordResetEmailSent",className:"reset-form alert alert-success"},c().createElement(m.FormattedMessage,{id:"password_send.link",defaultMessage:"If the account exists, a password reset email will be sent to:"}),c().createElement("div",null,c().createElement("b",null,t)),c().createElement("br",null),c().createElement(m.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})}))}componentDidMount(){const{intl:e,siteName:t}=this.props;document.title=e.formatMessage({id:"password_form.pageTitle",defaultMessage:"Password Reset | {siteName}"},{siteName:t||"Mattermost"})}render(){let e=null;this.state.error&&(e=c().createElement("div",{className:"form-group has-error"},c().createElement("label",{className:"control-label"},this.state.error)));let t="form-group";return e&&(t+=" has-error"),c().createElement("div",null,c().createElement(p.A,null),c().createElement("div",{className:"col-sm-12"},c().createElement("div",{className:"signup-team__container"},c().createElement(m.FormattedMessage,{id:"password_send.title",tagName:"h1",defaultMessage:"Password Reset"}),this.state.updateText,c().createElement("form",{onSubmit:this.handleSendLink,ref:this.resetForm},c().createElement("p",null,c().createElement(m.FormattedMessage,{id:"password_send.description",defaultMessage:"To reset your password, enter the email address you used to sign up"})),c().createElement("div",{className:t},c().createElement(f.A,{id:"passwordResetEmailInput",type:"email",name:"email",label:(0,m.defineMessage)({id:"password_send.email",defaultMessage:"Email"}),placeholder:(0,m.defineMessage)({id:"password_send.email.placeholder",defaultMessage:"Enter the email address you used to sign up"}),ref:this.emailInput,spellCheck:"false",autoFocus:!0})),e,c().createElement("button",{id:"passwordResetButton",type:"submit",className:"btn btn-primary"},c().createElement(m.FormattedMessage,{id:"password_send.reset",defaultMessage:"Reset my password"}))))))}}h(g,"propTypes",{siteName:o().string,actions:o().shape({sendPasswordResetEmail:o().func.isRequired}).isRequired});const b=(0,m.injectIntl)(g),E=(0,a.connect)((function(e){return{siteName:(0,l.zj)(e).SiteName}}),(e=>({actions:(0,r.bindActionCreators)({sendPasswordResetEmail:n.J1},e)})))(b)}}]);
//# sourceMappingURL=5968.ba5c45daf0bbe1e843bf.js.map