<commit_before>'use strict';

var React = require('react');
var Router = require('react-router');

var loginFormStore = require('../stores/login-form-store');
var platformManagerActionCreators = require('../action-creators/platform-manager-action-creators');

var LoginForm = React.createClass({
    getInitialState: getStateFromStores,
    componentDidMount: function () {
        loginFormStore.addChangeListener(this._onStoresChange);
    },
    componentWillUnmount: function () {
        loginFormStore.removeChangeListener(this._onStoresChange);
    },
    _onStoresChange: function () {
        this.setState(getStateFromStores());
    },
    _onInputChange: function () {
        this.setState({
            username: this.refs.username.getDOMNode().value,
            password: this.refs.password.getDOMNode().value,
            error: null,
        });
    },
    _onSubmit: function (e) {
        e.preventDefault();
        platformManagerActionCreators.requestAuthorization(
            this.state.username,
            this.state.password
        );
    },
    render: function () {
        return (
            <form className="login-form" onSubmit={this._onSubmit}>
                <input
                    className="login-form__field"
                    ref="username"
                    type="text"
                    placeholder="Username"
                    autoFocus
                    onChange={this._onInputChange}
                />
                <input
                    className="login-form__field"
                    ref="password"
                    type="password"
                    placeholder="Password"
                    onChange={this._onInputChange}
                />
                <input
                    className="button login-form__submit"
                    type="submit"
                    value="Log in"<commit_msg>Stop using deprecated getDOMNode()<commit_after>'use strict';

var React = require('react');
var Router = require('react-router');

var loginFormStore = require('../stores/login-form-store');
var platformManagerActionCreators = require('../action-creators/platform-manager-action-creators');

var LoginForm = React.createClass({
    getInitialState: getStateFromStores,
    componentDidMount: function () {
        loginFormStore.addChangeListener(this._onStoresChange);
    },
    componentWillUnmount: function () {
        loginFormStore.removeChangeListener(this._onStoresChange);
    },
    _onStoresChange: function () {
        this.setState(getStateFromStores());
    },
    _onUsernameChange: function (e) {
        this.setState({
            username: e.target.value,
            error: null,
        });
    },
    _onPasswordChange: function (e) {
        this.setState({
            password: e.target.value,
            error: null,
        });
    },
    _onSubmit: function (e) {
        e.preventDefault();
        platformManagerActionCreators.requestAuthorization(
            this.state.username,
            this.state.password
        );
    },
    render: function () {
        return (
            <form className="login-form" onSubmit={this._onSubmit}>
                <input
                    className="login-form__field"
                    type="text"
                    placeholder="Username"
                    autoFocus
                    onChange={this._onUsernameChange}
                />
                <input
                    className="login-form__field"
                    type="password"
                    placeholder="Password"
                    onChange={this._onPasswordChange}
                />
                <input
                    className="button login-form__submit"
                    type="submit"
                    value="Log in"
{'fraction_non_alphanumeric': 0.10615262740955901, 'fraction_numerical': 0.0, 'mean_word_length': 1.721264367816092, 'pattern_counts': {'":': 0, '<': 11, '<?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': '4043323', 'n_tokens_mistral': 950, 'n_tokens_neox': 913, 'n_words': 145}