<commit_before>"use strict";

import React         from "react";
import {             Link }                     from "react-router";
import Validator     from "validator";
import UserActions   from "../../actions/user";
import _             from "lodash";
import assign        from "object-assign";
import UserStore     from "../../stores/user";
import BaseComponent from "../base_component";
import { Paper, TextField, FlatButton, RaisedButton, FontIcon } from "material-ui";

class Login extends BaseComponent {

  constructor(props, context){
    super(props, context);

    this.stores = [UserStore];
    this.state = this.getState();

    this._bind("handleLogin", "validateAll", "validate", "validateEmail");
    if(this.state.loggedIn) {
      context.router.transitionTo("dashboard");
    }
  }

  getState() {
    return {
      loggedIn: UserStore.loggedIn(),
      validations: {}
    };
  }

  handleLogin(e){
    e.preventDefault();
    if(this.validateAll()){
      UserActions.login({
        email: this.refs.email.getValue(),
        password: this.refs.password.getValue()
      });
    }
  }

  validateAll(){
    return _.every([<commit_msg>adds user to login<commit_after>"use strict";

import React         from "react";
import {             Link }                     from "react-router";
import Validator     from "validator";
import UserActions   from "../../actions/user";
import _             from "lodash";
import assign        from "object-assign";
import UserStore     from "../../stores/user";
import BaseComponent from "../base_component";
import { Paper, TextField, FlatButton, RaisedButton, FontIcon } from "material-ui";

class Login extends BaseComponent {

  constructor(props, context){
    super(props, context);

    this.stores = [UserStore];
    this.state = this.getState();

    this._bind("handleLogin", "validateAll", "validate", "validateEmail");
    if(this.state.loggedIn) {
      context.router.transitionTo("dashboard");
    }
  }

  getState() {
    return {
      loggedIn: UserStore.loggedIn(),
      validations: {}
    };
  }

  handleLogin(e){
    e.preventDefault();
    if(this.validateAll()){
      UserActions.login({
        user: {
          email: this.refs.email.getValue(),
          password: this.refs.password.getValue()
        }
      });
    }
  }

  validateAll(){
    return _.every([
{'fraction_non_alphanumeric': 0.14116150911403136, 'fraction_numerical': 0.0, 'mean_word_length': 2.5703479576399393, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5093678', 'n_tokens_mistral': 681, 'n_tokens_neox': 668, 'n_words': 153}