<commit_before>import React from 'react';
import GoogleLogin from 'react-google-login';
import jwt from 'jsonwebtoken';
import dotenv from 'dotenv';
import {getUserData, registerGoogleUser} from '../../utils/Authorization';

dotenv.load()

export default class GoogleLogIn extends React.Component {
  reMap(obj) {
    let mainObj = {
      currentUser: {}
    };
    const username = obj
      .name
      .toLowerCase()
      .replace(/[\s]/, '_') + Math.round(Math.random(1998) * 56);
    mainObj.currentUser.username = username;
    mainObj.currentUser.fullName = obj.name;
    mainObj.currentUser.password = <PASSWORD>;
    mainObj.currentUser.email = obj.email;
    return mainObj;
  }
  render() {

    const responseGoogle = (response) => {
      const key = process.env.secretKey;

      if (response) {
        const decoded = jwt.decode(response.Zi.id_token);
        const newUserObj = this.reMap(decoded);
        this
          .props
          .emailExist({email: newUserObj.currentUser.email})
          .then((user) => {
            if (!user) {
              registerGoogleUser(newUserObj.currentUser).then((data) => {
                if (data) {
                  Materialize.toast('Signed Up Successfully', 2000, 'blue darken-4');
                }
              }).catch((err) => err)
            } else {
              getUserData({email: newUserObj.currentUser.email}).then((currentUser) => {
                currentUser.userId = currentUser.id;
                const token = jwt.sign({
                  currentUser
                }, 'Andelahellobooks');
                localStorage.setItem('token', token);
                Materialize.toast('Login Successful', 2000, 'blue', () => {
                  window.location.href = '/dashboard';
                });
              })

            }
          })
      }
    }
    return (<GoogleLogin
      clientId="993480706358-p6qn70ue8qucce00cpbfhsb52a87t451.apps.googleusercontent.com"
      buttonText="Login with Google"
      onSuccess={responseGoogle}
      onFailure={responseGoogle}/>)
  }
}
<commit_msg>bug(fix-unexpected-token) Fix unexpected token message in react google login<commit_after>import React from 'react';
import GoogleLogin from 'react-google-login';
import jwt from 'jsonwebtoken';
import dotenv from 'dotenv';
import {getUserData, registerGoogleUser} from '../../utils/Authorization';

dotenv.load()

export default class GoogleLogIn extends React.Component {
  reMap(obj) {
    let mainObj = {
      currentUser: {}
    };
    const username = obj
      .name
      .toLowerCase()
      .replace(/[\s]/, '_') + Math.round(Math.random(1998) * 56);
    mainObj.currentUser.username = username;
    mainObj.currentUser.fullName = obj.name;
    mainObj.currentUser.password = <PASSWORD>;
    mainObj.currentUser.email = obj.email;
    return mainObj;
  }
  render() {

    const responseGoogle = (response) => {
      const key = process.env.secretKey;

      if (response) {
        
        const decoded = jwt.decode(response.Zi.id_token);
        const newUserObj = this.reMap(decoded);
        this
          .props
          .emailExist({email: newUserObj.currentUser.email})
          .then((user) => {
            if (!user) {
              registerGoogleUser(newUserObj.currentUser).then((data) => {
                if (data) {
                  Materialize.toast('Signed Up Successfully', 2000, 'blue darken-4');
                }
              }).catch((err) => err)
            } else {
              getUserData({email: newUserObj.currentUser.email}).then((currentUser) => {
                currentUser.userId = currentUser.id;
                const token = jwt.sign({
                  currentUser
                }, 'Andelahellobooks');
                localStorage.setItem('token', token);
                Materialize.toast('Login Successful', 2000, 'blue', () => {
                  window.location.href = '/dashboard';
                });
              })

            }
          })
      }
    }
    return (<GoogleLogin
      clientId="993480706358-p6qn70ue8qucce00cpbfhsb52a87t451.apps.googleusercontent.com"
      buttonText="Login with Google"
      onSuccess={responseGoogle}
      onFailure={responseGoogle}/>)
  }
}

{'fraction_non_alphanumeric': 0.12606232294617564, 'fraction_numerical': 0.018885741265344664, 'mean_word_length': 2.065846599131693, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '5271168', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1206, 'n_words': 226}