<commit_before>import React, { Component } from 'react';
import { NavLink as Link } from 'react-router-dom';

import api from '../services/api';
import t from '../locale/he_IL';
import './RegisterForm.css';

class RegisterForm extends Component {
  state = {
    error: false,
    done: false,
  };

  constructor(props) {
    super(props);
    this.state = { email: '', password: '' };

    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    const target = event.target;
    const value = target.type === 'checkbox' ? target.checked : target.value;
    const name = target.name;

    this.setState({
      [name]: value,
    });

    event.preventDefault();
  }

  handleSubmit(event) {
    event.preventDefault();
    let {password, email} = this.state;
    api
      .post('/sign/up/', {
        password, email
      })
      .then((res) => this.setState({ done: true }))
      .catch((error) => this.setState({ error }));
  }

  render() {
    const { done, error } = this.state;
    let errorMessage = '';
    if (error) {
      if (error.response) {
        if (error.response.status === 409) {
          errorMessage = t.emailExists;
        } else if (error.response.data && error.response.data.data) {
          errorMessage = error.response.data.data;
        }
      }
      if (!errorMessage) {
        errorMessage = t.error;
      }
    }

    return (
      <form className="hpForm" onSubmit={this.handleSubmit}>
        {(errorMessage && !done) && (
          <div className="alert alert-danger">{errorMessage}</div>
        )}
        {!done && (
          <div>
            <strong className="d-d-block text-center">{t.signupNow}</strong>
            <div className="form-group">
              <label for="loginEmail">{t.emailAddress}:</label>
              <input
                onChange={this.handleChange}
                value={this.state.email}
                required
                type="email"
                name="email"
                id="loginEmail"
                placeholder="<EMAIL>"
              />
            </div>
            <div className="form-group">
              <label for="loginPassword">{t.password}:</label>
              <input
                onChange={this.handleChange}
                value={this.state.password}
                required
                type="password"
                name="password"
                id="loginPassword"
              />
            </div>
            <div className="form-group text-center">
              <button type="submit">{t.signup}</button>
            </div>
            <div className="text-start">
              <Link to="/sign/in">
                {t.alreadyGotAccount}
              </Link>
            </div>
          </div>
        )}

        {done && (
          <div className="alert alert-success">
            שלחו לך דואר אלקטרוני עם לינק להפעלת החשבון.
          </div>
        )}
      </form>
    );
  }
}

export default RegisterForm;
<commit_msg>fix typo in registration form email sent message<commit_after>import React, { Component } from 'react';
import { NavLink as Link } from 'react-router-dom';

import api from '../services/api';
import t from '../locale/he_IL';
import './RegisterForm.css';

class RegisterForm extends Component {
  state = {
    error: false,
    done: false,
  };

  constructor(props) {
    super(props);
    this.state = { email: '', password: '' };

    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(event) {
    const target = event.target;
    const value = target.type === 'checkbox' ? target.checked : target.value;
    const name = target.name;

    this.setState({
      [name]: value,
    });

    event.preventDefault();
  }

  handleSubmit(event) {
    event.preventDefault();
    let {password, email} = this.state;
    api
      .post('/sign/up/', {
        password, email
      })
      .then((res) => this.setState({ done: true }))
      .catch((error) => this.setState({ error }));
  }

  render() {
    const { done, error } = this.state;
    let errorMessage = '';
    if (error) {
      if (error.response) {
        if (error.response.status === 409) {
          errorMessage = t.emailExists;
        } else if (error.response.data && error.response.data.data) {
          errorMessage = error.response.data.data;
        }
      }
      if (!errorMessage) {
        errorMessage = t.error;
      }
    }

    return (
      <form className="hpForm" onSubmit={this.handleSubmit}>
        {(errorMessage && !done) && (
          <div className="alert alert-danger">{errorMessage}</div>
        )}
        {!done && (
          <div>
            <strong className="d-d-block text-center">{t.signupNow}</strong>
            <div className="form-group">
              <label for="loginEmail">{t.emailAddress}:</label>
              <input
                onChange={this.handleChange}
                value={this.state.email}
                required
                type="email"
                name="email"
                id="loginEmail"
                placeholder="<EMAIL>"
              />
            </div>
            <div className="form-group">
              <label for="loginPassword">{t.password}:</label>
              <input
                onChange={this.handleChange}
                value={this.state.password}
                required
                type="password"
                name="password"
                id="loginPassword"
              />
            </div>
            <div className="form-group text-center">
              <button type="submit">{t.signup}</button>
            </div>
            <div className="text-start">
              <Link to="/sign/in">
                {t.alreadyGotAccount}
              </Link>
            </div>
          </div>
        )}

        {done && (
          <div className="alert alert-success">
            שלחנו לך דואר אלקטרוני עם לינק להפעלת החשבון.
          </div>
        )}
      </form>
    );
  }
}

export default RegisterForm;

{'fraction_non_alphanumeric': 0.14267100977198696, 'fraction_numerical': 0.000977198697068404, 'mean_word_length': 1.6793193717277486, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 65, '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': '3287407', 'n_tokens_mistral': 1806, 'n_tokens_neox': 1749, 'n_words': 345}