signout from google
This commit is contained in:
parent
4cbdbf1079
commit
7593b83632
@ -108,4 +108,10 @@ class LoginController extends Controller
|
|||||||
abort(403);
|
abort(403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function loggedOut(Request $request)
|
||||||
|
{
|
||||||
|
$request->session()->flash('loggedOut', true);
|
||||||
|
return redirect($this->redirectPath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
resources/js/app.js
vendored
17
resources/js/app.js
vendored
@ -39,3 +39,20 @@ window.onSignIn = function(googleUser) {
|
|||||||
alert('Login fail')
|
alert('Login fail')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.googleApiOnload = function() {
|
||||||
|
gapi.load('auth2', function() {
|
||||||
|
gapi.auth2.init();
|
||||||
|
$(document).trigger('googleApiOnload');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(() => {
|
||||||
|
$('#logout-link').on('click', e => {
|
||||||
|
e.preventDefault()
|
||||||
|
let googleAuth = gapi.auth2.getAuthInstance();
|
||||||
|
googleAuth.signOut().then(() => {
|
||||||
|
$('#logout-form').submit()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|||||||
@ -18,6 +18,11 @@
|
|||||||
Register successful!
|
Register successful!
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if(session('loggedOut'))
|
||||||
|
<div class="alert alert-success">You are logged out</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@auth
|
@auth
|
||||||
You are logged in!
|
You are logged in!
|
||||||
@else
|
@else
|
||||||
|
|||||||
@ -8,12 +8,13 @@
|
|||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
<meta name="google-signin-scope" content="profile email">
|
<meta name="google-signin-scope" content="profile email">
|
||||||
<meta name="google-signin-client_id" content="{{ config('app.googleApi.clientId') }}">
|
<meta name="google-signin-client_id" content="{{ config('app.googleApi.clientId') }}">
|
||||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
<script src="{{ asset('js/app.js') }}"></script>
|
||||||
|
<script src="https://apis.google.com/js/platform.js?onload=googleApiOnload" async defer></script>
|
||||||
|
|
||||||
<title>{{ config('app.name', 'Laravel') }}</title>
|
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="{{ asset('js/app.js') }}" defer></script>
|
|
||||||
|
|
||||||
<!-- Fonts -->
|
<!-- Fonts -->
|
||||||
<link rel="dns-prefetch" href="//fonts.gstatic.com">
|
<link rel="dns-prefetch" href="//fonts.gstatic.com">
|
||||||
@ -48,9 +49,7 @@
|
|||||||
</li>
|
</li>
|
||||||
@else
|
@else
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="dropdown-item" href="{{ route('logout') }}"
|
<a class="nav-link" href="#" id="logout-link">
|
||||||
onclick="event.preventDefault();
|
|
||||||
document.getElementById('logout-form').submit();">
|
|
||||||
{{ __('Logout') }}
|
{{ __('Logout') }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user