From 8b3071253ea6208fa80df062ff7afb142cb338e6 Mon Sep 17 00:00:00 2001
From: Lucas Schoenfelder <les17@inf.ufpr.br>
Date: Thu, 3 Dec 2020 12:18:41 -0300
Subject: [PATCH] fixed log out

---
 src/Components/SignUpContainerFunction.js | 32 ++++++++++-------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/Components/SignUpContainerFunction.js b/src/Components/SignUpContainerFunction.js
index d4304eff..3c877b30 100644
--- a/src/Components/SignUpContainerFunction.js
+++ b/src/Components/SignUpContainerFunction.js
@@ -25,14 +25,20 @@ import styled from 'styled-components'
 import {device} from './device.js'
 import FormInput from "./FormInput.js"
 import {StyledCloseModalButton, DialogContentDiv, DialogHeaderStyled, SocialConnectDiv, StyledGoogleLoginButton, H3Div} from './LoginContainer.js'
+import {apiUrl} from '../env.js'
+import {GoogleLoginButton} from './LoginContainerFunction'
 import ValidateUserInput from '../Components/FormValidationFunction.js'
+import GoogleLogo from "../img/logo_google.svg"
 
 var Recaptcha = require('react-recaptcha')
 
-var callback = function () {
-  console.log('Done!!!!');
-};
-
+async function handleGoogleAttempt () {
+	console.log("handleGoogleAttempt")
+	let request_url = (
+        `${apiUrl}/omniauth/google_oauth2?auth_origin_url=` + window.location.href + '&omniauth_window_type=sameWindow&resource_class=User'
+    )
+    window.location.replace(request_url)
+}
 export default function SignUpContainer (props) {
     const [formNome, setNome] = useState(
         {
@@ -132,14 +138,10 @@ export default function SignUpContainer (props) {
 
             <DialogContentDiv>
                 <SocialConnectDiv>
-                    <StyledGoogleLoginButton
-                        clientId="658977310896-knrl3gka66fldh83dao2rhgbblmd4un9.apps.googleusercontent.com"
-                        onSuccess={responseGoogle}
-                        onFailure={responseGoogle}
-                        cookiePolicy={'single_host_origin'}
-                    >
-                        <span style={{textTransform:"none", fontSize:"13px"}}>Usando o Google</span>
-                    </StyledGoogleLoginButton>
+                        <GoogleLoginButton onClick={handleGoogleAttempt}>
+                            <img src={GoogleLogo} alt="google-logo" className="google-logo"/>
+                            <span>Usando o Google</span>
+                        </GoogleLoginButton>
                 </SocialConnectDiv>
 
                 <H3Div>
@@ -183,12 +185,6 @@ export default function SignUpContainer (props) {
                         help = {formSenha.key ? (formSenha.value.length == 0 ? "Faltou digitar sua senha." : "A senha precisa ter no mínimo 8 caracteres.") : ""}
                         />
                     <br/>
-                    <Recaptcha
-                        sitekey="6LcyFr8UAAAAAOd0Po6rmZC1D_nYik8nLCAkNKsc"
-                        size="normal"
-                        render="explicit"
-                        onloadCallback={callback}
-                    />
                     <ConfirmContainerStyled>
                         <StyledSignUpButton type="submit" variant="contained">
                             <span
-- 
GitLab