<commit_before>var React = require('react');
var ReactRouter = require('react-router');
var Link = ReactRouter.Link;
var TitleMixin = require('./titleMixin');
var auth = require('../flux/auth');

var LogIn = React.createClass({
  mixins: [
    TitleMixin('log in')
  ],
  getInitialState: function() {
    return {credentials: auth.getCredentials(), busy: auth.isBusy(), error: null};
  },
  _authListener: function() {
    this.setState({credentials: auth.getCredentials(), busy: auth.isBusy(), error: auth.getError()});
  },
  componentWillMount: function() {
    auth.clearError();
  },
  componentDidMount: function() {
    auth.listen(this._authListener);
  },
  componentWillUnmount: function() {
    auth.unlisten(this._authListener);
  },
  componentWillUpdate: function(nextProps, nextState) {
    if (nextState.credentials) {
      var location = this.props.location;
      if (location.state && location.state.nextLocation) {
        this.props.history.replaceState(null, location.state.nextLocation.pathname, location.state.nextLocation.query);
      } else {
        this.props.history.replaceState(null, '/');
      }
    }
  },
  render: function() {
    return (
      <div id='logIn'>
        <h1>
          log in
        </h1>
        <form onSubmit={this._onSubmit}>
          <input type='email' ref='emailAddress' name='emailAddress' placeholder='email address' disabled={this.state.busy} required/>
          <input type='password' ref='password' name='password' placeholder='password' disabled={this.state.busy} required/>
          {this.state.error
            ? <p className='error'>
                {this.state.error}
              </p>
            : null}
          <div>
            <button disabled={this.state.busy} className='highlighted'>log in</button>
            <Link to='/forgotPassword'>
              Are you locked out?
            </Link>
          </div>
        </form>
      </div>
    );<commit_msg>Added an explanatory message on redirect to /logIn.<commit_after>var React = require('react');
var ReactRouter = require('react-router');
var Link = ReactRouter.Link;
var TitleMixin = require('./titleMixin');
var auth = require('../flux/auth');

var LogIn = React.createClass({
  mixins: [
    TitleMixin('log in')
  ],
  getInitialState: function() {
    return {credentials: auth.getCredentials(), busy: auth.isBusy(), error: null};
  },
  _authListener: function() {
    this.setState({credentials: auth.getCredentials(), busy: auth.isBusy(), error: auth.getError()});
  },
  componentWillMount: function() {
    auth.clearError();
  },
  componentDidMount: function() {
    auth.listen(this._authListener);
  },
  componentWillUnmount: function() {
    auth.unlisten(this._authListener);
  },
  componentWillUpdate: function(nextProps, nextState) {
    if (nextState.credentials) {
      var location = this.props.location;
      if (location.state && location.state.nextLocation) {
        this.props.history.replaceState(null, location.state.nextLocation.pathname, location.state.nextLocation.query);
      } else {
        this.props.history.replaceState(null, '/');
      }
    }
  },
  render: function() {
    var location = this.props.location;
    var nextLocation = location.state ? location.state.nextLocation : null;
    return (
      <div id='logIn'>
        <h1>
          log in
        </h1>
        {nextLocation ? (
          <p>
            You must log in before you can go to {nextLocation.pathname}.
          </p>
        ) : null}
        <form onSubmit={this._onSubmit}>
          <input type='email' ref='emailAddress' name='emailAddress' placeholder='email address' disabled={this.state.busy} required/>
          <input type='password' ref='password' name='password' placeholder='password' disabled={this.state.busy} required/>
          {this.state.error
            ? <p className='error'>
                {this.state.error}
              </p>
            : null}
          <div>
            <button disabled={this.state.busy} className='highlighted'>log in</button>
            <Link to='/forgotPassword'>
              Are you locked out?
            </Link>
          </div>
        </form>
      </div>
    );
{'fraction_non_alphanumeric': 0.14643453374672072, 'fraction_numerical': 0.0009539709038874314, 'mean_word_length': 2.653310104529617, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '5248937', 'n_tokens_mistral': 1216, 'n_tokens_neox': 1214, 'n_words': 249}