<commit_before>import React from 'react';
import TextInput from './TextInput.jsx';
import Button from './Button.jsx';

class SignInForm extends React.Component {
  constructor() {
    super();
    this.state = {apiKey: '', email: ''};
  }

  login(e) {
    e.preventDefault();
    localStorage.email = this.state.email;
    localStorage.apiKey = this.state.apiKey;
    console.log(localStorage.email);
    console.log(localStorage.apiKey);
  }

  onEmailChange(e) {
    this.setState({email: e.target.value});
  }

  onAPIKeyChange(e) {
    this.setState({apiKey: e.target.value});
  }

  render() {
    return <form onSubmit={this.login}>
      <label htmlFor="email">Email address</label>
      <TextInput id="email"
        name="email"
        placeholder="Your zulip account's email address"
        onChange={this.onEmailChange}
      />
      <label htmlFor="API-key">API Key</label>
      <TextInput id="API-key" 
        name="API-key" <commit_msg>use react cookie instead of local storage<commit_after>import React from 'react';
import TextInput from './TextInput.jsx';
import Button from './Button.jsx';
import cookie from 'react-cookie';

class SignInForm extends React.Component {
  constructor() {
    super();
    this.state = {apiKey: '', email: ''};
  }

  login(e) {
    e.preventDefault();
    cookie.save('email', this.state.email, { path: '/' });
    cookie.save('apiKey', this.state.apiKey, { path: '/' });
  }

  onEmailChange(e) {
    this.setState({email: e.target.value});
  }

  onAPIKeyChange(e) {
    this.setState({apiKey: e.target.value});
  }

  render() {
    return <form onSubmit={this.login}>
      <label htmlFor="email">Email address</label>
      <TextInput id="email"
        name="email"
        placeholder="Your zulip account's email address"
        onChange={this.onEmailChange}
      />
      <label htmlFor="API-key">API Key</label>
      <TextInput id="API-key" 
        name="API-key" 
{'fraction_non_alphanumeric': 0.15822130299896586, 'fraction_numerical': 0.0, 'mean_word_length': 3.117021276595745, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, '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': '890425', 'n_tokens_mistral': 624, 'n_tokens_neox': 619, 'n_words': 124}