diff --git a/app/containers/RegisterEmail/index.js b/app/containers/RegisterEmail/index.js index 43ae7000..363aa155 100644 --- a/app/containers/RegisterEmail/index.js +++ b/app/containers/RegisterEmail/index.js @@ -56,7 +56,7 @@ class RegisterEmail extends Component { } componentWillUnmount() { - this.props.resetState() + this.props.resetState(); } onAlertOk = () => { @@ -133,6 +133,12 @@ class RegisterEmail extends Component { error_phone } = errorFields || false; + + const socialId = typeof this.props.prefilledData !== 'undefined' ? this.props.prefilledData.social_id : null; + const first = typeof this.props.prefilledData !== 'undefined' || '' ? this.props.prefilledData.first_name : text => this.handleInputChange('first_name', text); + const last = typeof this.props.prefilledData !== 'undefined' || '' ? this.props.prefilledData.last_name : text => this.handleInputChange('last_name', text); + const emails = typeof this.props.prefilledData !== 'undefined' || '' ? this.props.prefilledData.email : text => this.handleInputChange('email', text); + const checkEmail = this.checkEmail(email) === false && email !== ''; const checkUsername = typeof (username) !== 'undefined' && username.length < 4 && username !== ''; const checkPassword = password.length < 4 && password !== ''; @@ -143,55 +149,74 @@ class RegisterEmail extends Component { - this.handleInputChange('first_name', text)} value={first_name} - /> - : this.handleInputChange('first_name', text)} + value={first} + />} + {socialId === null ? this.handleInputChange('last_name', text)} value={last_name} - /> + /> : this.handleInputChange('last_name', text)} + value={last} + />} { checkEmail ? invalid email address : null } - this.handleInputChange('email', text)} value={email} - /> - { checkUsername ? + /> : this.handleInputChange('email', text)} + value={emails} + />} + { { checkUsername !== 'undefined' ? username should be 4 at minimum : null - } + } } this.handleInputChange('username', text)} value={username} /> - { checkPassword ? + { { checkPassword ? password should be 4 at minimum : null - } + } }