<commit_before>import React, { Component, PropTypes, cloneElement } from 'react';
import { LoginStatus } from './Facebook';
import FacebookProvider from './FacebookProvider';

export default class Login extends Component {
  static propTypes = {
    scope: PropTypes.string.isRequired,
    fields: PropTypes.array.isRequired,
    onSubmit: PropTypes.func.isRequired,
    onReady: PropTypes.func,
    onWorking: PropTypes.func,
    children: PropTypes.node.isRequired,
    returnScopes: PropTypes.bool,
    rerequest: PropTypes.bool,
  };

  static contextTypes = {
    ...FacebookProvider.childContextTypes,
  };

  static defaultProps = {
    scope: '',
    fields: ['id', 'first_name', 'last_name', 'middle_name',
      'name', 'locale', 'gender', 'timezone', 'verified', 'link'],
    returnScopes: false,
    rerequest: false,
  };

  constructor(props, context) {
    super(props, context);

    this.state = {};
  }

  componentDidMount() {
    this.context.facebook.whenReady((err, facebook) => {
      if (err) {
        this.props.onSubmit(err);
        return;
      }

      this.setState({ facebook });

      if (this.props.onReady) {
        this.props.onReady();
      }
    });
  }

  onClick = (evn) => {
    evn.stopPropagation();
    evn.preventDefault();

    const isWorking = this.isWorking();
    if (isWorking) {
      return;
    }

    this.setWorking(true);

    const { scope, fields, onSubmit, returnScopes, rerequest } = this.props;
    const facebook = this.state.facebook;
    const loginQpts = { scope };

    if (returnScopes) {
      loginQpts.return_scopes = true;
    }

    if (rerequest) {
      loginQpts.auth_type = 'rerequest';
    }

    facebook.login(loginQpts, (err, loginStatus) => {
      if (err) {
        this.setWorking(false);
        onSubmit(err);
        return;
      }

      if (loginStatus !== LoginStatus.AUTHORIZED) {
        this.setWorking(false);
        onSubmit(new Error('Unauthorized user'));
        return;
      }

      facebook.getTokenDetailWithProfile({ fields }, (err2, data) => {
        this.setWorking(false);

        if (err2) {
          onSubmit(err2);
          return;
        }

        onSubmit(null, {
          profile: data.profile,
          signedRequest: data.tokenDetail.signedRequest,
        });
      });
    });
  }

  setWorking(working) {
    this.setState({ working });

    if (this.props.onWorking) {
      this.props.onWorking(working);
    }
  }
<commit_msg>Updated Login component to return whole data<commit_after>import React, { Component, PropTypes, cloneElement } from 'react';
import { LoginStatus } from './Facebook';
import FacebookProvider from './FacebookProvider';

export default class Login extends Component {
  static propTypes = {
    scope: PropTypes.string.isRequired,
    fields: PropTypes.array.isRequired,
    onResponse: PropTypes.func.isRequired,
    onReady: PropTypes.func,
    onWorking: PropTypes.func,
    children: PropTypes.node.isRequired,
    returnScopes: PropTypes.bool,
    rerequest: PropTypes.bool,
  };

  static contextTypes = {
    ...FacebookProvider.childContextTypes,
  };

  static defaultProps = {
    scope: '',
    fields: ['id', 'first_name', 'last_name', 'middle_name',
      'name', 'locale', 'gender', 'timezone', 'verified', 'link'],
    returnScopes: false,
    rerequest: false,
  };

  constructor(props, context) {
    super(props, context);

    this.state = {};
  }

  componentDidMount() {
    this.context.facebook.whenReady((err, facebook) => {
      if (err) {
        this.props.onResponse(err);
        return;
      }

      this.setState({ facebook });

      if (this.props.onReady) {
        this.props.onReady();
      }
    });
  }

  onClick = (evn) => {
    evn.stopPropagation();
    evn.preventDefault();

    const isWorking = this.isWorking();
    if (isWorking) {
      return;
    }

    this.setWorking(true);

    const { scope, fields, onResponse, returnScopes, rerequest } = this.props;
    const facebook = this.state.facebook;
    const loginQpts = { scope };

    if (returnScopes) {
      loginQpts.return_scopes = true;
    }

    if (rerequest) {
      loginQpts.auth_type = 'rerequest';
    }

    facebook.login(loginQpts, (err, loginStatus) => {
      if (err) {
        this.setWorking(false);
        onResponse(err);
        return;
      }

      if (loginStatus !== LoginStatus.AUTHORIZED) {
        this.setWorking(false);
        onResponse(new Error('Unauthorized user'));
        return;
      }

      facebook.getTokenDetailWithProfile({ fields }, (err2, data) => {
        this.setWorking(false);

        if (err2) {
          onResponse(err2);
          return;
        }

        onResponse(null, data);
      });
    });
  }

  setWorking(working) {
    this.setState({ working });

    if (this.props.onWorking) {
      this.props.onWorking(working);
    }
  }

{'fraction_non_alphanumeric': 0.13520722199425522, 'fraction_numerical': 0.0012310217480508822, 'mean_word_length': 2.524945770065076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6148435', 'n_tokens_mistral': 1546, 'n_tokens_neox': 1485, 'n_words': 293}