<commit_before>import React, {Component} from 'react';
import SweetAlert from 'sweetalert-react';

export default class Register extends Component {

    constructor(props) {
        super(props);
        this.state = {
            showError: false,
            errorTitle: "",
            errorMessage: undefined,
            errorType: "error",
            confirmText: undefined
        };
        this.verifyForm = this.verifyForm.bind(this);
    }

    verifyForm() {
        if (!this._login.value.toString() || !this._password1.value.toString() || !this._fullname.value.toString() || !this._password2.value.toString()) {
            this.state.errorTitle = "Хей!";
            this.state.errorMessage = "Забыл заполнить поля!";
            this.state.errorType = "warning";
            this.state.confirmText = "Упс! Сейчас заполню!";
            this.setState({showError: true});
        } else if (this._password1.value.toString() !== this._password2.value.toString()) {
            this.state.errorTitle = "Ой!";
            this.state.errorMessage = "Пароли не совпадают!";
            this.state.errorType = "error";
            this.state.confirmText = "Буду внимательней...";
            this.setState({showError: true});
        } else {
            let request = new XMLHttpRequest();
            request.open('POST', '/register', true);
            request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
            request.send(`login=${this._login.value.toString()}&password=${this._password1.value.toString()}&fullname=${this._fullname.value.toString()}`);
            this._login.value = this._password1.value = this._password1.value = this._password2.value = this._fullname.value = '';
            //Get user info and render the main window
            
        }
    }

    render() {<commit_msg>Redirect after registration<commit_after>import React, {Component} from 'react';
import SweetAlert from 'sweetalert-react';

export default class Register extends Component {

    constructor(props) {
        super(props);
        this.state = {
            showError: false,
            errorTitle: "",
            errorMessage: undefined,
            errorType: "error",
            confirmText: undefined
        };
        this.verifyForm = this.verifyForm.bind(this);
    }

    verifyForm() {
        if (!this._login.value.toString() || !this._password1.value.toString() || !this._fullname.value.toString() || !this._password2.value.toString()) {
            this.state.errorTitle = "Хей!";
            this.state.errorMessage = "Забыл заполнить поля!";
            this.state.errorType = "warning";
            this.state.confirmText = "Упс! Сейчас заполню!";
            this.setState({showError: true});
        } else if (this._password1.value.toString() !== this._password2.value.toString()) {
            this.state.errorTitle = "Ой!";
            this.state.errorMessage = "Пароли не совпадают!";
            this.state.errorType = "error";
            this.state.confirmText = "Буду внимательней...";
            this.setState({showError: true});
        } else {
            let request = new XMLHttpRequest();
            request.open('POST', '/register', true);
            request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
            request.send(`login=${this._login.value.toString()}&password=${this._password1.value.toString()}&fullname=${this._fullname.value.toString()}`);
            this._login.value = this._password1.value = this._password1.value = this._password2.value = this._fullname.value = '';
            //Get user info and render the main window
            window.location = "http://mytasks-pwa-zxspectrum.c9users.io/";
        }
    }

    render() {
{'fraction_non_alphanumeric': 0.142668776371308, 'fraction_numerical': 0.0050105485232067514, 'mean_word_length': 2.377560106856634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2105390', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1074, 'n_words': 188}