<commit_before>import { connect } from 'react-redux';
import React from 'react';
import ReactDOM from 'react-dom';
import * as actions from '../actions';
import {
  Grid,
  Row,
  Col,
  Panel,
  Button,
  FormGroup,
  ControlLabel,
  FormControl,
  Alert,
} from 'react-bootstrap';

class Login extends React.Component {
  static propTypes = {
    dispatch: React.PropTypes.func,
    loginMessage: React.PropTypes.string,
  };

  componentDidMount() {
    window.addEventListener('popstate', this.handlePopState);
    this.props.dispatch(actions.initApp());
  }

  componentWillUnmount() {
    window.removeEventListener('popstate', this.handlePopState);
  }

  handleLogin = () => {
    const account = ReactDOM.findDOMNode(this.refs.account).value;
    const password = ReactDOM.findDOMNode(this.refs.password).value;
    this.props.dispatch(actions.login(account, password));
  };

  renderAlert() {
    if (!this.props.loginMessage) {
      return '';
    }

    return (
      <Alert bsStyle="danger">
        {this.props.loginMessage}
      </Alert>
    );
  }

  render() {
    return (
      <Grid>
        <Row>
          <Col lg={4} md={4} sm={8} xs={12}>
            <Panel>
              {this.renderAlert()}
              <FormGroup>
                <ControlLabel>Account</ControlLabel>
                <FormControl ref="account" type="text" autoFocus />
              </FormGroup>
              <FormGroup>
                <ControlLabel>Password</ControlLabel>
                <FormControl ref="password" type="password" />
              </FormGroup>
              <Button bsStyle="primary" onClick={this.handleLogin}>
                Login
              </Button>
            </Panel>
          </Col>
        </Row>
      </Grid><commit_msg>Add test account to login page<commit_after>import { connect } from 'react-redux';
import React from 'react';
import ReactDOM from 'react-dom';
import * as actions from '../actions';
import {
  Grid,
  Row,
  Col,
  Panel,
  Button,
  FormGroup,
  ControlLabel,
  FormControl,
  Alert,
} from 'react-bootstrap';

class Login extends React.Component {
  static propTypes = {
    dispatch: React.PropTypes.func,
    loginMessage: React.PropTypes.string,
  };

  componentDidMount() {
    window.addEventListener('popstate', this.handlePopState);
    this.props.dispatch(actions.initApp());
  }

  componentWillUnmount() {
    window.removeEventListener('popstate', this.handlePopState);
  }

  handleLogin = () => {
    const account = ReactDOM.findDOMNode(this.refs.account).value;
    const password = ReactDOM.findDOMNode(this.refs.password).value;
    this.props.dispatch(actions.login(account, password));
  };

  renderAlert() {
    if (!this.props.loginMessage) {
      return '';
    }

    return (
      <Alert bsStyle="danger">
        {this.props.loginMessage}
      </Alert>
    );
  }

  render() {
    return (
      <Grid>
        <Row>
          <Col lg={4} md={4} sm={8} xs={12}>
            <Panel>
              {this.renderAlert()}
              <FormGroup>
                <ControlLabel>Account</ControlLabel>
                <FormControl ref="account" type="text" autoFocus />
              </FormGroup>
              <FormGroup>
                <ControlLabel>Password</ControlLabel>
                <FormControl ref="password" type="password" />
              </FormGroup>
              <ControlLabel>
              For test account, use "test/test"
              </ControlLabel>
              <br/>
              <Button bsStyle="primary" onClick={this.handleLogin}>
                Login
              </Button>
            </Panel>
          </Col>
        </Row>
      </Grid>
{'fraction_non_alphanumeric': 0.13278688524590163, 'fraction_numerical': 0.00273224043715847, 'mean_word_length': 2.126387702818104, 'pattern_counts': {'":': 0, '<': 50, '<?xml version=': 0, '>': 52, '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': '5796962', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1037, 'n_words': 206}