<commit_before>import React from 'react';
import Recaptcha from 'react-recaptcha';
import { FormGroup, FormControl, Form, ControlLabel, InputGroup, Col, Button } from 'react-bootstrap';
import isEmail from 'is-email';
import _ from 'lodash';
import axios from 'axios';

export default class Feedback extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      referrer: 'No referrer',
      subject: '',
      content: '',
      name: '',
      email: '',
      org: ''
    };
  }

  componentWillMount() {
    if (document.referrer) {
      this.setState({referrer : document.referrer});
    }
  }

  handleChange(e) {
    let nextState = _.cloneDeep(this.state);
    nextState[e.target.id] = e.target.value;
    this.setState(nextState);
  }

  validateField(fieldName) {
    if (fieldName === 'subject') {
      const length = this.state.subject.length;
      if (length > 10) return 'success';
      else if (length > 5) return 'warning';
      else if (length > 0) return 'error';
    }
    if (fieldName === 'name') {
      const length = this.state.name.length;
      if (length > 4) return 'success';
      else if (length > 2) return 'warning';
      else if (length > 0) return 'error';
    }
    if (fieldName === 'email') {<commit_msg>relax form validation a bit<commit_after>import React from 'react';
import Recaptcha from 'react-recaptcha';
import { FormGroup, FormControl, Form, ControlLabel, InputGroup, Col, Button } from 'react-bootstrap';
import isEmail from 'is-email';
import _ from 'lodash';
import axios from 'axios';

export default class Feedback extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      referrer: 'No referrer',
      subject: '',
      content: '',
      name: '',
      email: '',
      org: ''
    };
  }

  componentWillMount() {
    if (document.referrer) {
      this.setState({referrer : document.referrer});
    }
  }

  handleChange(e) {
    let nextState = _.cloneDeep(this.state);
    nextState[e.target.id] = e.target.value;
    this.setState(nextState);
  }

  validateField(fieldName) {
    if (fieldName === 'subject') {
      const length = this.state.subject.length;
      if (length > 2) return 'success';
      else if (length > 1) return 'warning';
      else if (length > 0) return 'error';
    }
    if (fieldName === 'name') {
      const length = this.state.name.length;
      if (length > 2) return 'success';
      else if (length > 1) return 'warning';
      else if (length > 0) return 'error';
    }
    if (fieldName === 'email') {
{'fraction_non_alphanumeric': 0.1423570595099183, 'fraction_numerical': 0.005056398288603656, 'mean_word_length': 2.8910741301059, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4380005', 'n_tokens_mistral': 815, 'n_tokens_neox': 802, 'n_words': 220}