<commit_before>import React, { Component } from 'react';
import { reduxForm, Field } from 'redux-form';
import { connect } from 'react-redux';

import * as actions from "../../actions";


class Signup extends Component {

    handleFormSubmit() {
        // this.props.signinUser({ email, password });
    }

    renderAlert() {
        if (this.props.errorMessage) {
            return (
                <div className="alert alert-danger">
                    <strong>Oops!</strong> {this.props.errorMessage}
                </div>
            );
        }
    }



    render() {
        const { handleSubmit } = this.props;

        return (
            <form onSubmit={handleSubmit(this.handleFormSubmit.bind(this))}>
                <fieldset className="form-group">
                    <label htmlFor="email" className="control-label">Email:</label>
                    <Field id="email" name="email" component="input" type="email" className="form-control" placeholder="Input email" />
                </fieldset>
                <fieldset className="form-group">
                    <label htmlFor="password" className="control-label">Password:</label>
                    <Field id="password" name="password" component="input" type="password" className="form-control" placeholder="Input password" />
                </fieldset>
                <fieldset className="form-group">
                    <label htmlFor="passwordConfirm" className="control-label">Confirm password:</label>
                    <Field id="passwordConfirm" name="passwordConfirm" component="input" type="password" className="form-control" placeholder="Input password" />
                </fieldset>
                {this.renderAlert()}
                <button action="submit" className="btn btn-primary">Sign up</button>
            </form>
        );
    }

}

function validate(formProps) {
    const errors = {};

    console.log(formProps);

    return errors;
}

Signup = reduxForm({ form: 'signup', validate })(Signup);


export default Signup<commit_msg>problem with touched<commit_after>import React, { Component } from 'react';
import { reduxForm, Field } from 'redux-form';
import { connect } from 'react-redux';

import * as actions from "../../actions";


class Signup extends Component {

    handleFormSubmit() {
        // this.props.signinUser({ email, password });
    }

    renderAlert() {
        if (this.props.errorMessage) {
            return (
                <div className="alert alert-danger">
                    <strong>Oops!</strong> {this.props.errorMessage}
                </div>
            );
        }
    }



    render() {
        const { handleSubmit } = this.props;

        return (
            <form onSubmit={handleSubmit(this.handleFormSubmit.bind(this))}>
                <fieldset className="form-group">
                    <label htmlFor="email" className="control-label">Email:</label>
                    <Field id="email" name="email" component="input" type="email" className="form-control" label="Input email" />
                    {email.touched && ((error && <span>{error}</span>))}
                </fieldset>
                <fieldset className="form-group">
                    <label htmlFor="password" className="control-label">Password:</label>
                    <Field id="password" name="password" component="password" type="password" className="form-control" label="Input password" />
                    {password.touched && ((error && <span>{error}</span>))}
                </fieldset>
                <fieldset className="form-group">
                    <label htmlFor="passwordConfirm" className="control-label">Confirm password:</label>
                    <Field id="passwordConfirm" name="passwordConfirm" component="password" type="password" className="form-control" label="Input password" />
                    {passwordConfirm.touched && ((error && <span>{error}</span>))}
                </fieldset>
                {this.renderAlert()}
                <button action="submit" className="btn btn-primary">Sign up</button>
            </form>
        );
    }

}

function validate(values) {
    const errors = {};

    if (!values.email) {
        errors.email = 'Required'
    } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) {
        errors.email = 'Invalid email address'
    }
    if (!values.password)
        errors.password = 'Required'

    if (!values.passwordConfirm)
        errors.passwordConfirm = 'Required'

    if (values.password !== values.passwordConfirm) {
        errors.password = "Passwords must match"
    }

    return errors;
}

Signup = reduxForm({ form: 'signup', validate })(Signup);


export default Signup
{'fraction_non_alphanumeric': 0.14611968703742864, 'fraction_numerical': 0.0012687671812222456, 'mean_word_length': 2.1894807821982467, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, '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': '3719263', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1212, 'n_words': 255}