<commit_before>import React from 'react';
import { Button, Popover, Navbar, Tooltip, OverlayTrigger, Form, FormGroup, FormControl, Col} from 'react-bootstrap';
import Modal from 'react-modal';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { unloadLoginModal, loadSignUpModal, unloadSignUpModal } from '../actions/modalPopUpActions';

export class Login extends React.Component {

  constructor(props, ctx) {
      super(props);
      console.log('login constructor called');
      this.login = this.login.bind(this);
  }

  login() {
    console.log('Logging user in');
    console.log('email:', this.refs.loginEmail.value);
    console.log('passwd:', this.refs.loginPasswd.value);
  }

  render() {
    console.log('Login modal render');
    const customStyles = {
      content : {
        top                   : '50%',
        left                  : '50%',
        right                 : 'auto',
        bottom                : 'auto',
        marginRight           : '-50%',
        transform             : 'translate(-50%, -50%)'
      }
    };
    return (
      <div>
        <Modal
          isOpen={this.props.showLogin}
           onRequestClose={this.props.unloadLoginModal}
           style={customStyles}
        >
        <h2>Login</h2>
          <form onSubmit={this.login}>
            Email: <input type="text" name="Email" ref="loginEmail" /><br />
            Password: <input type="password" name="password" ref="loginPasswd" />
            <input type="submit" value="Submit" />
          </form>
        </Modal>
      </div>
    )
  }
}

function mapStateToProps(state) {
  return {
    showLogin : state.ui.showLoginModal
  }
}

function matchDispatchToProps(dispatch) {
  return bindActionCreators({ unloadLoginModal : unloadLoginModal, loadSignUpModal : loadSignUpModal} , dispatch)
}

export default connect(mapStateToProps, matchDispatchToProps)(Login);
<commit_msg>login onChange<commit_after>import React from 'react';
import { Button, Popover, Navbar, Tooltip, OverlayTrigger, Form, FormGroup, FormControl, Col} from 'react-bootstrap';
import Modal from 'react-modal';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { unloadLoginModal, loadSignUpModal, unloadSignUpModal } from '../actions/modalPopUpActions';

export class Login extends React.Component {

  constructor(props, ctx) {
      super(props);
      console.log('login constructor called');
      this.login = this.login.bind(this);
      this.onFieldChange = this.onFieldChange.bind(this);
      this.state = {
        email : '',
        passwd : ''
      }
  }

  login(e) {
    e.preventDefault();
    console.log('Logging user in');
    console.log('email:', this.refs.loginEmail.value);
    console.log('passwd:', this.refs.loginPasswd.value);
  }

  onFieldChange(e) {
    //e.preventDefault();
    const state = this.state;
    state[e.target.name] = e.target.value;
    this.setState(state);
  }

  render() {
    console.log('Login modal render');
    const customStyles = {
      content : {
        top                   : '50%',
        left                  : '50%',
        right                 : 'auto',
        bottom                : 'auto',
        marginRight           : '-50%',
        transform             : 'translate(-50%, -50%)'
      }
    };
    const { email, passwd} = this.state;
    return (
      <div>
        <Modal
          isOpen={this.props.showLogin}
           onRequestClose={this.props.unloadLoginModal}
           style={customStyles}
        >
        <h2>Login</h2>
          <form onSubmit={this.login}>
            Email: <input type="text" name="email" value={email} onChange={this.onFieldChange} /><br />
            Password: <input type="password" name="passwd" value={passwd} onChange={this.onFieldChange} />
            <input type="submit" value="Submit" />
          </form>
        </Modal>
      </div>
    )
  }
}

function mapStateToProps(state) {
  return {
    showLogin : state.ui.showLoginModal
  }
}

function matchDispatchToProps(dispatch) {
  return bindActionCreators({ unloadLoginModal : unloadLoginModal, loadSignUpModal : loadSignUpModal} , dispatch)
}

export default connect(mapStateToProps, matchDispatchToProps)(Login);

{'fraction_non_alphanumeric': 0.13437719093246087, 'fraction_numerical': 0.00560878709978967, 'mean_word_length': 2.4516129032258065, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1440319', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1254, 'n_words': 259}