<commit_before>/**
  * AuthContainer.jsx
  * Created by <NAME> 10/13/16
  **/

import React from 'react';
import { hashHistory } from 'react-router';

import LoginMax from '../../components/login/LoginMax.jsx';

import * as LoginHelper from '../../helpers/loginHelper.js';

export default class AuthContainer extends React.Component {
	constructor(props) {
		super(props);

		this.state = {
			ticket: '',
			error: ''
		};
	}

	componentDidMount() {
		this.extractTicket();
	}

	extractTicket() {
		const url = window.location.href;
		// MAX may insert the ticket in the middle of the URL instead of at the end like a civilised person
		const regex = /ticket=([A-Za-z0-9]|\.|-)+/g;
		const regexOutput = regex.exec(url);
		if (regexOutput) {
			const ticket = regexOutput[0].substring('ticket='.length);
			this.setState({
				ticket: ticket,
				error: ''
			}, () => {
				LoginHelper.performMaxLogin(this.state.ticket);
			});
		}
		else {
			// no ticket found, display error
			this.setState({
				ticket: '',
				error: 'An error occurred while validating the user account. Try again later.'
			});

		}
	}

	render() {
		return (
			<LoginMax errorMessage={this.state.error} />
		)
	}
}<commit_msg>Strip the ticket from the URL<commit_after>/**
  * AuthContainer.jsx
  * Created by <NAME> 10/13/16
  **/

import React from 'react';
import { hashHistory } from 'react-router';

import LoginMax from '../../components/login/LoginMax.jsx';

import * as LoginHelper from '../../helpers/loginHelper.js';

export default class AuthContainer extends React.Component {
	constructor(props) {
		super(props);

		this.state = {
			ticket: '',
			error: ''
		};
	}

	componentDidMount() {
		this.extractTicket();
	}

	extractTicket() {
		const url = window.location.href;
		// MAX may insert the ticket in the middle of the URL instead of at the end like a civilised person
		const regex = /ticket=([A-Za-z0-9]|\.|-)+/g;
		const regexOutput = regex.exec(url);
		if (regexOutput) {
			const ticket = regexOutput[0].substring('ticket='.length);
			this.setState({
				ticket: ticket,
				error: ''
			}, () => {
				// remove the ticket from the URL
				const updatedUrl = url.replace('?ticket=' + this.state.ticket, '');
				window.history.replaceState({}, null, updatedUrl);
				LoginHelper.performMaxLogin(this.state.ticket);
			});
		}
		else {
			// no ticket found, display error
			this.setState({
				ticket: '',
				error: 'An error occurred while validating the user account. Try again later.'
			});

		}
	}

	render() {
		return (
			<LoginMax errorMessage={this.state.error} />
		)
	}
}
{'fraction_non_alphanumeric': 0.15271885846509833, 'fraction_numerical': 0.006941766293868106, 'mean_word_length': 3.1044303797468356, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '7379658', 'n_tokens_mistral': 965, 'n_tokens_neox': 831, 'n_words': 218}