<commit_before>const _ = require('lodash')
import React from "react";
import {FormGroup as FG} from "react-bootstrap";
import {Field, reduxForm} from "redux-form";
import Input from "app/src/components/Input";
import {Link} from "react-router";

function FormGroup(props) {
  props = {...props, bsClass: 'form-group m-b-md'}
  return <FG {...props}>{props.children}</FG>
}
const constraints = {
  username: {
    presence: true,
  },
  password: {
    presence: true,
  },
};

const validate = require('app/util/validate')(constraints)

class LoginForm extends React.Component {
  render() {
    const {username, password, handleSubmit, pristine, submitting} = this.props;
    return (
      <form
        className="m-x-auto text-center app-login-form"
        role="form"
        method="POST"
        onSubmit={(e) => {
          e.preventDefault();
          if (this.props.valid) {
            handleSubmit(username, password);
          }
        }}>
        <Link to="/" className="app-brand m-b-lg"
              style={{width: '100%', textDecoration: 'none', fontFamily: 'Roboto-Bold'}}>
          <h1>[Dank]</h1>
        </Link>
        <Field component={Input} placeholder='username' name='username' value={username}/>
        <Field component={Input} placeholder='password' name='password' type='password' value={password}
               componentClasses={{'FormGroup': FormGroup}}/>

        <div className="m-b-lg">
          <button className="btn btn-primary">Log In</button>
          <button className="btn btn-default">Sign up</button>
        </div>

        <footer className="screen-login">
          <a href="#" className="text-muted">Forgot password</a>
        </footer>
      </form>
    )
  }
}

export default reduxForm({
  form: 'loginform',
  validate
})(LoginForm);<commit_msg>refactors LoginForm to pure component<commit_after>const _ = require('lodash')
import React from "react";
import {FormGroup as FG} from "react-bootstrap";
import {Field, reduxForm} from "redux-form";
import Input from "app/src/components/Input";
import {Link} from "react-router";

function FormGroup(props) {
  props = {...props, bsClass: 'form-group m-b-md'}
  return <FG {...props}>{props.children}</FG>
}
const constraints = {
  username: {
    presence: true,
  },
  password: {
    presence: true,
  },
};

const validate = require('app/util/validate')(constraints)

function LoginForm(props) {
  const {username, password, handleSubmit, pristine, submitting} = props;
  return (
    <form
      className="m-x-auto text-center app-login-form"
      role="form"
      method="POST"
      onSubmit={(e) => {
        e.preventDefault();
        if (props.valid) {
          handleSubmit(username, password);
        }
      }}>
      <Link to="/" className="app-brand m-b-lg"
            style={{width: '100%', textDecoration: 'none', fontFamily: 'Roboto-Bold'}}>
        <h1>[Dank]</h1>
      </Link>
      <Field component={Input} placeholder='username' name='username' value={username}/>
      <Field component={Input} placeholder='password' name='password' type='password' value={password}
             componentClasses={{'FormGroup': FormGroup}}
      />

      <div className="m-b-lg">
        <button className="btn btn-primary">Log In</button>
        <button className="btn btn-default">Sign up</button>
      </div>

      <footer className="screen-login">
        <a href="#" className="text-muted">Forgot password</a>
      </footer>
    </form>
  )
}

export default reduxForm({
  form: 'loginform',
  validate
})(LoginForm);
{'fraction_non_alphanumeric': 0.1636619718309859, 'fraction_numerical': 0.0028169014084507044, 'mean_word_length': 3.026077097505669, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 45, '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': '963591', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1081, 'n_words': 244}