<commit_before>var RegistrationForm = $class({
    getInitialState: function() {
        return {}
    },

    render: function() {
        return (
        <div className="panel panel-primary">
            <div className="panel-heading">{transl("Registration")}</div>
            <form className="panel-body" onSubmit={this.onSubmit}>
                <div className="form-group">
                    <label for="regName">{transl("nickname")}</label>
                    <input type="text" className="form-control" id="regName" placeholder="my-domain.base.network" />
                </div>
                <div className="form-group">
                    <label for="regInviteCode">
                        {transl("invite code")}
                    </label>
                    <input type="text" className="form-control" id="regInviteCode" placeholder={transl("invite code")} />
                    <small>(<a href="#" onClick={this.onGetInviteCode}>{transl("Receive the invite code")}</a>)</small>
                </div>
                {this.state.error && <div className="alert alert-danger">
                    {this.state.error}
                </div>}
                {this.state.progress && <div className="progress">
                    <div className="progress-bar progress-bar-striped active" style={{width: (this.state.progress/4*100|0)+"%"}} />
                </div>}
                <div className="form-group">
                    <button className="btn btn-primary" type="submit">{transl("Sign Me Up")}</button>
                &nbsp;
                    <button className="btn btn-default" onClick={this.onClose}>{transl("Close")}</button>
                </div>
            </form>
        </div>
        );
    },

    onClose: function(ev) {
        ev && ev.preventDefault();
        ev && ev.stopPropagation();
        this.close();
    },

    close: function() {
        this.props.onClose();
    },

    onSubmit: function(ev) {
        ev && ev.preventDefault();
        ev && ev.stopPropagation();

        var name = document.getElementById('regName').value.trim().toLowerCase();
        var code = document.getElementById('regInviteCode').value.trim();
        var cc = code.match(/^([a-z0-9]{10})([a-f0-9]{4})$/);

        if(!/^[a-z][a-z0-9\-]{2,60}$/.test(name)) {
            return this.setState({error: transl("Incorrect domain name"), err: null});
        }
        if(!cc || !_.sha256(cc[1]).substr(0, 4)) {
            return this.setState({error: transl("Invalid invite code"), err: null});<commit_msg>change length of invite-code<commit_after>var RegistrationForm = $class({
    getInitialState: function() {
        return {}
    },

    render: function() {
        return (
        <div className="panel panel-primary">
            <div className="panel-heading">{transl("Registration")}</div>
            <form className="panel-body" onSubmit={this.onSubmit}>
                <div className="form-group">
                    <label for="regName">{transl("nickname")}</label>
                    <input type="text" className="form-control" id="regName" placeholder="my-domain.base.network" />
                </div>
                <div className="form-group">
                    <label for="regInviteCode">
                        {transl("invite code")}
                    </label>
                    <input type="text" className="form-control" id="regInviteCode" placeholder={transl("invite code")} />
                    <small>(<a href="#" onClick={this.onGetInviteCode}>{transl("Receive the invite code")}</a>)</small>
                </div>
                {this.state.error && <div className="alert alert-danger">
                    {this.state.error}
                </div>}
                {this.state.progress && <div className="progress">
                    <div className="progress-bar progress-bar-striped active" style={{width: (this.state.progress/4*100|0)+"%"}} />
                </div>}
                <div className="form-group">
                    <button className="btn btn-primary" type="submit">{transl("Sign Me Up")}</button>
                &nbsp;
                    <button className="btn btn-default" onClick={this.onClose}>{transl("Close")}</button>
                </div>
            </form>
        </div>
        );
    },

    onClose: function(ev) {
        ev && ev.preventDefault();
        ev && ev.stopPropagation();
        this.close();
    },

    close: function() {
        this.props.onClose();
    },

    onSubmit: function(ev) {
        ev && ev.preventDefault();
        ev && ev.stopPropagation();

        var name = document.getElementById('regName').value.trim().toLowerCase();
        var code = document.getElementById('regInviteCode').value.trim();
        var cc = code.match(/^([a-zA-Z0-9]{14})([a-f0-9]{4})$/);

        if(!/^[a-z][a-z0-9\-]{2,60}$/.test(name)) {
            return this.setState({error: transl("Incorrect domain name"), err: null});
        }
        if(!cc || !_.sha256(cc[1]).substr(0, 4)) { // check CRC
            return this.setState({error: transl("Invalid invite code"), err: null});
{'fraction_non_alphanumeric': 0.1741167284794066, 'fraction_numerical': 0.008979113800507515, 'mean_word_length': 1.9363896848137536, 'pattern_counts': {'":': 0, '<': 65, '<?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': '1756300', 'n_tokens_mistral': 1452, 'n_tokens_neox': 1390, 'n_words': 248}