<commit_before>import * as React from 'react';
import { browserHistory } from 'react-router';
import { Form } from 'formsy-react';
import {
  FormsyCheckbox,
  FormsyDate,
  FormsyText,
} from 'formsy-material-ui/lib';
import i from '../i18n';
import SigninDialog from './SigninDialog';
import NetworkError from '../Dialogs/NetworkError';
import { signin } from './api';
import debug from 'debug';
const log = debug('app:Signin');

export default class SiginForm extends React.Component<any, any> {

  constructor(props) {
    super(props);
    this.state = {
      canSubmit: false,
      openDialog: false,
      networkErr: false,
    };
    this.submit = this.submit.bind(this);
  }

  submit(user) {
    this.setState({ canSubmit: false });
    signin(user)
      .then((res) => {
        if (res['err']) return this.setState({ openDialog: true });
        browserHistory.push(`/confirm/${user.email}`);
      })
      .catch(err => this.setState({ networkErr: true }));
  }

  render() {
    return (
      <Form
        onValid={() => this.setState({ canSubmit: true })}
        onInvalid={() => this.setState({ canSubmit: false })}
        onSubmit={this.submit}
      >
        <FormsyText
          name="name"
          value="<NAME>"
          required={true}
          fullWidth={true}
          floatingLabelText={i('Full Name')}
          validations="minLength:3"
          validationError={i('Full name too short! Minimum 3 chars')}
        />
        <FormsyText
          name="email"
          value="<EMAIL>"
          required={true}
          fullWidth={true}
          floatingLabelText={i('E-mail')}
          validations="isEmail"
          validationError={i('Wrong e-mail address!')}
        />
        <FormsyDate
          name="birthday"
          floatingLabelText={i('Date of birth')}
          required={true}
          fullWidth={true}
        />
        <FormsyText
          name="password1"
          type="password"
          value="<PASSWORD>"
          required={true}
          fullWidth={true}
          floatingLabelText={i('Password')}
          validations="minLength:6"
          validationError={i('Password too short! Minimum 6 chars')}
        />
        <FormsyText
          name="password2"
          type="password"
          value="secret"
          required={true}
          fullWidth={true}
          floatingLabelText={i('Repeat Password')}
          validations="equalsField:password1"
          validationError={i('The passwords must be the same')}
        />
        <div className="checkbox">
          <FormsyCheckbox
            value={true}
            required={true}
            name="agree"
            label={i('I agree to the Terms of Service')}
            validations="isTrue"
            validationError={i('You should agree with Terms of Service')}
          />
        </div>
        <button<commit_msg>Removed default values from SigninForm<commit_after>import * as React from 'react';
import { browserHistory } from 'react-router';
import { Form } from 'formsy-react';
import {
  FormsyCheckbox,
  FormsyDate,
  FormsyText,
} from 'formsy-material-ui/lib';
import i from '../i18n';
import SigninDialog from './SigninDialog';
import NetworkError from '../Dialogs/NetworkError';
import { signin } from './api';
import debug from 'debug';
const log = debug('app:Signin');

export default class SiginForm extends React.Component<any, any> {

  constructor(props) {
    super(props);
    this.state = {
      canSubmit: false,
      openDialog: false,
      networkErr: false,
    };
    this.submit = this.submit.bind(this);
  }

  submit(user) {
    this.setState({ canSubmit: false });
    signin(user)
      .then((res) => {
        if (res['err']) return this.setState({ openDialog: true });
        browserHistory.push(`/confirm/${user.email}`);
      })
      .catch(err => this.setState({ networkErr: true }));
  }

  render() {
    return (
      <Form
        onValid={() => this.setState({ canSubmit: true })}
        onInvalid={() => this.setState({ canSubmit: false })}
        onSubmit={this.submit}
      >
        <FormsyText
          name="name"
          required={true}
          fullWidth={true}
          floatingLabelText={i('Full Name')}
          validations="minLength:3"
          validationError={i('Full name too short! Minimum 3 chars')}
        />
        <FormsyText
          name="email"
          required={true}
          fullWidth={true}
          floatingLabelText={i('E-mail')}
          validations="isEmail"
          validationError={i('Wrong e-mail address!')}
        />
        <FormsyDate
          name="birthday"
          floatingLabelText={i('Date of birth')}
          required={true}
          fullWidth={true}
        />
        <FormsyText
          name="password1"
          type="password"
          required={true}
          fullWidth={true}
          floatingLabelText={i('Password')}
          validations="minLength:6"
          validationError={i('Password too short! Minimum 6 chars')}
        />
        <FormsyText
          name="<PASSWORD>"
          type="password"
          required={true}
          fullWidth={true}
          floatingLabelText={i('Repeat Password')}
          validations="equalsField:password1"
          validationError={i('The passwords must be the same')}
        />
        <div className="checkbox">
          <FormsyCheckbox
            value={true}
            required={true}
            name="agree"
            label={i('I agree to the Terms of Service')}
            validations="isTrue"
            validationError={i('You should agree with Terms of Service')}
          />
        </div>
        <button
{'fraction_non_alphanumeric': 0.13633961599436323, 'fraction_numerical': 0.0029945393693852386, 'mean_word_length': 2.135284373274434, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, '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': '2240925', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1593, 'n_words': 345}