1"use strict";(self.webpackChunkfood_rx=self.webpackChunkfood_rx||[]).push([[5788],{65788:(s,r,e)=>{e.r(r),e.d(r,{default:()=>w});var o=e(9950),t=e(61189),a=e(4504),n=(e(59386),e(20926)),i=e(44414);class d extends o.PureComponent{constructor(s){super(s),this.goToSignup=()=>{this.props.history.push("/signup")},this.handleChange=s=>{const r=this.state.formData;r[s.target.name]=s.target.value,this.setState({formData:r})},this.onSubmit=()=>this.props.onSubmit(this.state.formData),this.state={formData:{password:"",password_confirmation:""}}}render(){return(0,i.jsxs)(n.lV,{children:[(0,i.jsxs)(n.gE,{children:[(0,i.jsx)(n.JU,{for:"exampleEmail",children:"Password"}),(0,i.jsx)(n.pd,{type:"password",name:"password",placeholder:"Password",autoComplete:"off",onChange:this.handleChange})]}),(0,i.jsxs)(n.gE,{children:[(0,i.jsx)(n.JU,{for:"exampleEmail",children:"Password Confirmation"}),(0,i.jsx)(n.pd,{type:"password",name:"password_confirmation",placeholder:"Password Confirmation",autoComplete:"off",onChange:this.handleChange})]}),(0,i.jsx)(n.$n,{color:"none",className:"button",onClick:this.onSubmit,children:"Reset Password"})]})}}var h=e(41397),p=e(27976),l=(e(40660),e(29382)),c=e(62);class m extends o.PureComponent{constructor(s){super(s),this.onSubmit=s=>{const{history:r}=this.props,e=(0,h.get)(this.headerData,"token");c.A.trackWithProperties("RECOVER_PASSWORD_SUBMIT",{password_length:s&&s.password?s.password.length:0,token_present:Boolean(e),deep_link_url:window.location.href}),this.validateInputs(s)&&(this.props.clearError(),this.props.onSubmit(s,this.headerData).then((()=>{c.A.trackWithProperties("RECOVER_PASSWORD_SUCCESS",{token_present:Boolean(e),deep_link_url:window.location.href}),r.push("/",{message:"Your Password has been reset."})})).catch((s=>{c.A.trackWithProperties("RECOVER_PASSWORD_ERROR",{token_present:Boolean(e),error_message:s,deep_link_url:window.location.href}),console.log(s)})))},this.validateInputs=s=>this.validPassword(s.password)&&this.validPassword(s.password_confirmation)&&this.passwordsMatch(s.password,s.password_confirmation),this.headerData=l.parse(this.props.location.search)}componentDidMount(){const s=(0,h.get)(this.headerData,"token");c.A.trackWithProperties("RECOVER_PASSWORD_SCREEN",{token_present:Boolean(s),deep_link_url:window.location.href})}passwordsMatch(s,r){const{addError:e}=this.props;return s===r||(c.A.trackWithProperties("RECOVER_PASSWORD_VALIDATION_ERROR",{type:"mismatch_confirmation",deep_link_url:window.location.href}),e("Passwords do not match"),!1)}validPassword(s){const{addError:r}=this.props;return(0,h.isEmpty)(s)?(c.A.trackWithProperties("RECOVER_PASSWORD_VALIDATION_ERROR",{type:"empty_password",deep_link_url:window.location.href}),r("Please input password."),!1):!(s.length<6)||(c.A.trackWithProperties("RECOVER_PASSWORD_VALIDATION_ERROR",{type:"short_password",password_length:s.length,deep_link_url:window.location.href}),r("Too short password. Input at least 6 characters."),!1)}render(){document.title="Forgot Password | FoodRx";const{onSubmit:s}=this;return(0,i.jsxs)("div",{className:"backgroundImage",children:[(0,i.jsx)("div",{className:"offset-sm-1 col-md-5",children:(0,i.jsx)("h2",{className:"heading",children:"Reset Your Password"})}),(0,i.jsxs)("div",{className:"offset-md-5 col-md-3",children:[(0,i.jsx)("div",{className:"hasError",children:this.props.error}),(0,i.jsx)("div",{className:"hasMessage",children:this.props.message}),(0,i.jsx)(d,{onSubmit:s})]})]})}}const w=(0,t.Ng)((s=>({error:s.get("auth").form.error})),(s=>({clearError:r=>s(p.A.clearError(r)),onSubmit:(r,e)=>new Promise(((o,t)=>s(p.A.recoverPasswordRequest(r,e,o,t)))),addError:r=>s(p.A.addError(r))})))((0,a.A)(m))}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.