<commit_before>import React from 'react';
import HoodieApi from '../services/hoodie.services.js';
import LocalClient from '../stores/local-client.stores.jsx';

import WarningMessage from './warning-message.components.jsx';
import WaitForLoad from './wait-for-load.components.jsx';

export default class Signin extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			warningMessage:undefined,
		};
	}

	componentWillMount() {
		this.client = LocalClient.instance();
		this.setState({
			loading: true,
		});
	}

	signIn(e) {
		this.setState({
			loading: false,
		});

		e.preventDefault();

		const login = React.findDOMNode(this.refs.email).value.toLowerCase();
		const password = React.findDOMNode(this.refs.password).value;

		HoodieApi.login(`user/${login}`,
			password)
			.then(() => {
				this.client.dispatchAction('/login', { });
			})
			.catch((err) => {console.log(err);
				this.setState({
					warningMessage: err.error === 'unauthorized' ? 'You made a mistake in your email or password' : 'An unexpected error occured please contact <EMAIL> and provide us with your username',
					loading:true,
				});
			})

		return;
	}

	componentWillUnmount() {
		this.setState({
			loading: false,
		});<commit_msg>Signin component never displayed the Incorrect Password warning<commit_after>import React from 'react';
import HoodieApi from '../services/hoodie.services.js';
import LocalClient from '../stores/local-client.stores.jsx';

import WarningMessage from './warning-message.components.jsx';
import WaitForLoad from './wait-for-load.components.jsx';

export default class Signin extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			warningMessage:undefined,
		};
	}

	componentWillMount() {
		this.client = LocalClient.instance();
		this.setState({
			loading: true,
		});
	}

	signIn(e) {
		this.setState({
			loading: false,
		});

		e.preventDefault();

		const login = React.findDOMNode(this.refs.email).value.toLowerCase();
		const password = React.findDOMNode(this.refs.password).value;

		HoodieApi.login(`user/${login}`,
			password)
			.then(() => {
				this.client.dispatchAction('/login', { });
			})
			.catch((err) => {
				this.setState({
					warningMessage: /unauthorized/i.test(err.message) ?
						'Incorrect email or password' :
						'An unexpected error occured, please contact <EMAIL> and mention your current email',
					loading: true,
				});
			});

		return;
	}

	componentWillUnmount() {
		this.setState({
			loading: false,
		});
{'fraction_non_alphanumeric': 0.14934808376135913, 'fraction_numerical': 0.0, 'mean_word_length': 3.768361581920904, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '6636605', 'n_tokens_mistral': 905, 'n_tokens_neox': 788, 'n_words': 170}