import React, { Component } from 'react';
import { browserHistory } from 'react-router';
import { connect } from 'react-redux';
import { verifyPassword } from '../../actions/signup/signupContactActions';
import PasswordInput from './forms/PasswordInput';

class NextStepContent extends Component {
  constructor(props) {
      super(props);

      this.state = {
        showSuccessContent: false
      };
  }

  componentWillMount() {
    // check user logged in
    if (!this.props.contactExists) {
      window.location = '/register';
    } else if (!this.props.currentUser){
      window.location = '/login';
    }
  }

  render() {
    const component = this.getContent();
    return (
      <div>
        {component}
      </div>
    );
  }

  getContent() {
    if (this.props.contactExists && !this.state.showSuccessContent) {
      return (
        <PasswordInput
          verifyPassword={this.props.verifyPassword}
          showSuccessContent={() => { this.setState({ showSuccessContent: true }); }}
        />
      );
    } else if (this.state.showSuccessContent) {
      return (
        <div>
        </div>
      );
    }

    return null;
  }
}

const mapStateToProps = (state) => {
  return {
  };
};

const mapDispatchToProps = (dispatch) => {
  return {
    verifyPassword: (password) => dispatch(verifyPassword(password))
  };
};

export default connect(mapStateToProps, mapDispatchToProps)(NextStepContent);

@@ -1094,32 +1094,186 @@
 (%0A        %3Cdiv%3E%0A
+          %3Cdiv%3E%0A            Looks like you are all set up!%0A            You can now access %3Ca href='/admin/dashboard'%3Eyour dashboard!%3C/a%3E%0A          %3C/div%3E%0A
         %3C/div%3E%0A 

add success message