<commit_before>import React, {Component} from 'react';
import PropTypes from 'prop-types';
import idx from 'idx';
import {connect} from 'react-redux';

import GitHubLoginButton from './GitHubLoginButton';
import Modal from './Modal';

class Login extends Component {
  static propTypes = {
    isAuthenticated: PropTypes.bool
  };

  static contextTypes = {
    router: PropTypes.object.isRequired
  };

  componentDidMount() {
    if (this.props.isAuthenticated) {
      this.context.router.push('/');
    }
  }

  shouldComponentUpdate(nextProps) {
    return this.props.isAuthenticated === nextProps.isAuthenticated;
  }

  componentDidUpdate(nextProps) {
    if (nextProps.isAuthenticated) {
      this.context.router.push('/');
    }
  }

  render() {
    return (
      <Modal title="Login">
        <p>To continue you will need to first authenticate using your GitHub account.</p>
        <p style={{textAlign: 'center'}}>
          <GitHubLoginButton next={idx(this.context.router, _ => _.query.next)} />
        </p>
        <p style={{textAlign: 'center', marginBottom: 0}}>
          <small>
            Zeus asks for both public and private permissions, however we will never<commit_msg>fix: Correct next redirect propagation in login component<commit_after>import React, {Component} from 'react';
import PropTypes from 'prop-types';
import idx from 'idx';
import {connect} from 'react-redux';

import GitHubLoginButton from './GitHubLoginButton';
import Modal from './Modal';

class Login extends Component {
  static propTypes = {
    isAuthenticated: PropTypes.bool
  };

  static contextTypes = {
    router: PropTypes.object.isRequired
  };

  componentDidMount() {
    if (this.props.isAuthenticated) {
      this.context.router.push('/');
    }
  }

  shouldComponentUpdate(nextProps) {
    return this.props.isAuthenticated === nextProps.isAuthenticated;
  }

  componentDidUpdate(nextProps) {
    if (nextProps.isAuthenticated) {
      this.context.router.push('/');
    }
  }

  render() {
    return (
      <Modal title="Login">
        <p>To continue you will need to first authenticate using your GitHub account.</p>
        <p style={{textAlign: 'center'}}>
          <GitHubLoginButton
            next={idx(this.context.router, _ => _.location.query.next)}
          />
        </p>
        <p style={{textAlign: 'center', marginBottom: 0}}>
          <small>
            Zeus asks for both public and private permissions, however we will never
{'fraction_non_alphanumeric': 0.12373635260816822, 'fraction_numerical': 0.0008087343307723412, 'mean_word_length': 3.1028192371475956, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '6116868', 'n_tokens_mistral': 731, 'n_tokens_neox': 716, 'n_words': 186}