<commit_before>import React, {Component} from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import FontIcon from 'material-ui/FontIcon';
import TextField from 'material-ui/TextField';

const customContentStyle = {
  width: '30%',
  maxWidth: 'none',
};

 class LoginModal extends Component {
  constructor(){
    super();
    this.state = {
      open: false
    }
  }

  handleOpen = () => {
    this.setState({open: true});
  };

  handleClose = () => {
    this.setState({open: false});
  };

  render() {
    const actions = [
      <RaisedButton
        label="Cancelar"
        buttonStyle={{
          borderRadius: 0,
        }}
        style={{
          boxShadow: 0,
          marginRight: 10
        }}
        onTouchTap={this.handleClose}
      />,
      <RaisedButton
        backgroundColor="#FF5252"
        labelColor="#FFF"
        label="Ingresar"
        buttonStyle={{
          borderRadius: 0
        }}
        style={{
          boxShadow: 0
        }}
        onTouchTap={this.handleClose}
      />,
    ];

    return (
      <div>
        <RaisedButton
          backgroundColor="#FF5252"
          labelColor="#FFF"
          label="Iniciar Sesión"
          buttonStyle={{
            borderRadius: 0
          }}
          onTouchTap={this.handleOpen}
          style={{
            boxShadow: 0
          }}
        />
        <Dialog title="INICIAR SESIÓN" actions={actions} open={this.state.open} contentStyle={customContentStyle} className='text-center'>
          <TextField
            hintText="Escriba su email"
            floatingLabelText="Usuario"
            fullWidth={true}
            floatingLabelStyle={{color: '#4c5661'}}
            underlineFocusStyle={{borderColor: '#000'}}
          />
          <TextField
            hintText="Escriba su constraseña"
            floatingLabelText="Contraseña"
            type="password"
            fullWidth={true}
            floatingLabelStyle={{color: '#4c5661'}}
            underlineFocusStyle={{borderColor: '#000'}}
          />
        </Dialog>
      </div>
    );
  }
}

export default LoginModal
<commit_msg>Added logic to login<commit_after>import React, {Component} from 'react';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import FontIcon from 'material-ui/FontIcon';
import TextField from 'material-ui/TextField';

const customContentStyle = {
  width: '30%',
  maxWidth: 'none',
};

 class LoginModal extends Component {
  constructor(){
    super();
    this.state = {
      open: false,
      user: {
        email: "",
        password: ""
      }
    }
  }

  handleOpen = () => {
    this.setState({open: true});
  };

  handleClose = () => {
    this.setState({open: false});
  };

  handleChangeValue = (e) => {
    const u = this.state.user
    if(u.hasOwnProperty(e.target.name)) {
      u[e.target.name] = e.target.value
      this.setState({user: u})
    }
  };

  handleLogin = () => {
    console.log(this.state.user)
    fetch('https://automotive-api.herokuapp.com/login', {
          method: 'POST',
          headers: {
            "content-type": "application/json",
            "Accept": "application/json",
          },
          body: JSON.stringify({
            "credentials": this.state.user }),
    })
    .then(resp => console.log(resp))
  }

  checkValuesForm = () => {
    if (this.state.user.email === "" || this.state.user.password === "" ){
      return false
    }
    return true
  }

  render() {
    const actions = [
      <RaisedButton
        label="Cancelar"
        buttonStyle={{
          borderRadius: 0,
        }}
        style={{
          boxShadow: 0,
          marginRight: 10
        }}
        onTouchTap={this.handleClose}
      />,
      <RaisedButton
        backgroundColor="#FF5252"
        labelColor="#FFF"
        label="Ingresar"
        disabled={!this.checkValuesForm()}
        buttonStyle={{
          borderRadius: 0
        }}
        style={{
          boxShadow: 0
        }}
        onTouchTap={this.handleLogin}
      />,
    ];

    return (
      <div>
        <RaisedButton
          backgroundColor="#FF5252"
          labelColor="#FFF"
          label="Iniciar Sesión"
          buttonStyle={{
            borderRadius: 0
          }}
          onTouchTap={this.handleOpen}
          style={{
            boxShadow: 0
          }}
        />
        <Dialog title="INICIAR SESIÓN" actions={actions} open={this.state.open} contentStyle={customContentStyle} className='text-center'>
          <TextField
            hintText="Escriba su email"
            floatingLabelText="Usuario"
            fullWidth={true}
            name="email"
            floatingLabelStyle={{color: '#4c5661'}}
            underlineFocusStyle={{borderColor: '#000'}}
            onChange={this.handleChangeValue}
          />
          <TextField
            hintText="Escriba su constraseña"
            floatingLabelText="Contraseña"
            type="password"
            fullWidth={true}
            name="password"
            floatingLabelStyle={{color: '#4c5661'}}
            underlineFocusStyle={{borderColor: '#000'}}
            onChange={this.handleChangeValue}
          />
        </Dialog>
      </div>
    );
  }
}

export default LoginModal

{'fraction_non_alphanumeric': 0.13327188940092166, 'fraction_numerical': 0.012534562211981567, 'mean_word_length': 1.9109442060085837, 'pattern_counts': {'":': 3, '<': 21, '<?xml version=': 0, '>': 29, 'https://': 1, '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': '2970712', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1573, 'n_words': 281}