Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <meta name="google-signin-scope" content="profile email">
- <meta name="google-signin-client_id" content="#HgetClientId()#">
- <script src="https://apis.google.com/js/platform.js" async defer></script>
- ...
- <body>
- Please log in with your Google account to access content! If you found this page accidentally then most likely you have no access rights on this page.
- <div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
- <script>
- function send(FD)
- {
- var xhr = new XMLHttpRequest();
- xhr.qpage=this;
- xhr.responseType = "text";
- xhr.onreadystatechange = function() {
- if (this.readyState == 4) {
- if(this.status == 200)
- {
- var page=this.qpage;
- eval(this.responseText);
- }
- else
- {
- this.qpage.dispose("Server communication XHR fault. Status code: "+this.status);
- }
- }
- }.bind(xhr);
- xhr.open("POST",'?login=true');
- xhr.send(FD);
- }
- function onSignIn(googleUser) {
- var fd = new FormData();
- var profile = googleUser.getBasicProfile();
- console.log("Google API login attempt: ID: " + profile.getId());
- console.log("ID: " + profile.getId());
- 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());
- fd.append("id_token", googleUser.getAuthResponse().id_token);
- var id_token = googleUser.getAuthResponse().id_token;
- console.log("ID Token: " + id_token);
- send(fd);
- };
- </script>
- <a href="#" onclick="signOut();">Sign out</a><br/>
- <a href="#HFotok.clargs.contextPath#/listing/">enter</a>
- <script>
- function signOut() {
- var fd=new FormData();
- fd.append("signout", "true");
- send(fd);
- var auth2 = gapi.auth2.getAuthInstance();
- auth2.signOut().then(function () {
- });
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement