<commit_before>import React, {Component, PropTypes} from 'react';
import BaseView from './../../core/base-view';
import {connect} from 'react-redux';
const sha1 = require('js-sha1');

import {userModel} from './../../api/user-model';

class Login extends BaseView {

    constructor() {
        super();

        const view = this;

        view.addScript();

    }

    addScript() {

        const view = this;

        // TODO: try to fix it
        console.warn('onSignIn was add to global scope!!');
        window.onSignIn = googleUser => view.onSignIn(googleUser);

        const script = document.createElement('script');
        script.src = 'https://apis.google.com/js/platform.js';

        document.body.appendChild(script);

    }

    onSignIn(googleUser) {
        // Useful data for your client-side scripts:
        const profile = googleUser.getBasicProfile();
        console.log('ID: ' + profile.getId()); // Don't send this directly to your server!
        console.log('Full Name: ' + profile.getName());
        console.log('Given Name: ' + profile.getGivenName());
        console.log('Family Name: ' + profile.getFamilyName());
        console.log('Image URL: ' + profile.getImageUrl());
        console.log('Email: ' + profile.getEmail());

        // The ID token you need to pass to your backend:
        const id_token = googleUser.getAuthResponse().id_token;
        console.log('ID Token: ' + id_token);

        // userModel.setTokenId(id_token);
        userModel.setStaticId(sha1(profile.getImageUrl()));

    }

    render() {

        return <div>
            <meta name="google-signin-scope" content="profile email"/>
            <meta name="google-signin-client_id"
                  content="318371264940-fm4d2matpc7kei3a0kf5rko51c3kvcot.apps.googleusercontent.com"/>
            <div className="g-signin2" data-onsuccess="onSignIn" data-theme="dark"/>

            <hr/>

        </div>;

    }

}

Login.propTypes = {};

export default connect(
    state => ({}),
    {}
)(Login);<commit_msg>in progress...<commit_after>import React, {Component, PropTypes} from 'react';
import BaseView from './../../core/base-view';
import {connect} from 'react-redux';
const sha1 = require('js-sha1');

import {userModel} from './../../api/user-model';

class Login extends BaseView {

    constructor() {
        super();

        const view = this;

        view.addScript();

    }

    addScript() {

        const view = this;

        // TODO: try to fix it
        console.warn('onSignIn was add to global scope!!');
        window.onSignIn = googleUser => view.onSignIn(googleUser);

        const script = document.createElement('script');
        script.src = 'https://apis.google.com/js/platform.js';

        document.body.appendChild(script);

    }

    onSignIn(googleUser) {
        // Useful data for your client-side scripts:
        const profile = googleUser.getBasicProfile();
        console.log('ID: ' + profile.getId()); // Don't send this directly to your server!
        console.log('Full Name: ' + profile.getName());
        console.log('Given Name: ' + profile.getGivenName());
        console.log('Family Name: ' + profile.getFamilyName());
        console.log('Image URL: ' + profile.getImageUrl());
        console.log('Email: ' + profile.getEmail());

        // The ID token you need to pass to your backend:
        const id_token = googleUser.getAuthResponse().id_token;
        console.log('ID Token:', id_token);

        // userModel.setTokenId(id_token);
        userModel.setStaticId(sha1(profile.getEmail()));

    }

    render() {

        return <div>
            <meta name="google-signin-scope" content="profile email"/>
            <meta name="google-signin-client_id"
                  content="318371264940-fm4d2matpc7kei3a0kf5rko51c3kvcot.apps.googleusercontent.com"/>
            <div className="g-signin2" data-onsuccess="onSignIn" data-theme="dark"/>

            <hr/>

        </div>;

    }

}

Login.propTypes = {};

export default connect(
    state => ({}),
    {}
)(Login);
{'fraction_non_alphanumeric': 0.15049261083743842, 'fraction_numerical': 0.012315270935960592, 'mean_word_length': 2.4679760888129803, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 2, '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': '914260', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1184, 'n_words': 256}