<commit_before>// @flow

import DjangoCSRFToken from 'django-react-csrftoken'
import React from 'react';

class SignInController extends React.PureComponent<{||}> {

  render(): React$Node {
    return (
      <div>
        Welcome back. Log into your account.
        <form action='/login/' method="post">
            <DjangoCSRFToken />
            Email:
            <input type="text" name="username" />
            Password:
            <input type="password" name="password" />
            <button type="submit">Login</button>
        </form>
      </div>
    );
  }
}

export default SignInController;<commit_msg>fleshing out signin page, will likely switch over to a standalone application<commit_after>// @flow

import DjangoCSRFToken from 'django-react-csrftoken'
import NavigationDispatcher from '../stores/NavigationDispatcher.js';
import React from 'react';
import Section from '../enums/Section.js';

type State = {|
  username: string,
  password: string,
|}

class SignInController extends React.PureComponent<{||}, State> {

  constructor(): void {
    super();
    this.state = {
      username: '',
      password: '',
    };
  }

  render(): React$Node {
    return (
      <div>
        Welcome back. Log into your account.
        <form method="post" onSubmit={this._signIn.bind(this)}>
            <DjangoCSRFToken />
            Email:
            <input
              name="username"
              onChange={e => this.setState({username: e.target.value})}
              type="text"
            />
            Password:
            <input
              name="password"
              onChange={e => this.setState({password: e.target.value})}
              type="password"
            />
            <button type="submit">Login</button>
        </form>
      </div>
    );
  }

  _signIn(): void {
    const xhr = new XMLHttpRequest();
    xhr.open("POST", '/login/', true);
    xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhr.onreadystatechange = () => {
      // $FlowFixMe
      if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 0) {
        console.log('login success', xhr.responseText);
        NavigationDispatcher.dispatch({
          type: 'SET_SECTION',
          section: Section.FindProjects,
        });
      }
    };
    xhr.send(this.state);
  }
}

export default SignInController;
{'fraction_non_alphanumeric': 0.13959390862944163, 'fraction_numerical': 0.00042301184433164127, 'mean_word_length': 2.183041722745626, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '4620743', 'n_tokens_mistral': 688, 'n_tokens_neox': 677, 'n_words': 149}