2018-06-12 02:53:47 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
|
|
<title>Hotel Services</title>
|
|
|
|
|
|
|
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
|
|
|
|
|
|
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h1>Hotel Services.</h1>
|
|
|
|
|
|
|
|
Please log in to continue:<br />
|
|
|
|
<br />
|
|
|
|
<div class="g-signin2" data-onsuccess="onSignIn"></div>
|
|
|
|
|
|
|
|
You can Sign out here:
|
|
|
|
<a href="#" onclick="signOut();">Sign out</a>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
function onSignIn(googleUser) {
|
|
|
|
var profile = googleUser.getBasicProfile();
|
|
|
|
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
|
|
|
|
console.log('Name: ' + profile.getName());
|
|
|
|
console.log('Image URL: ' + profile.getImageUrl());
|
|
|
|
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
|
|
|
|
|
|
|
|
var userID = profile.getEmail().substr(0,profile.getEmail().search("@"));
|
|
|
|
console.log("User ID: " + userID);
|
|
|
|
|
|
|
|
var postForm = document.createElement("form");
|
|
|
|
postForm.action = "./users/add";
|
|
|
|
postForm.method = "POST";
|
|
|
|
|
|
|
|
var data = document.createElement("input");
|
|
|
|
data.type = "hidden";
|
|
|
|
data.name = "userID";
|
|
|
|
data.value = userID;
|
|
|
|
postForm.appendChild(data);
|
|
|
|
|
|
|
|
data = document.createElement("input");
|
|
|
|
data.type = "hidden";
|
|
|
|
data.name = "userName";
|
|
|
|
data.value = profile.getName();
|
|
|
|
postForm.appendChild(data);
|
|
|
|
|
|
|
|
data = document.createElement("input");
|
|
|
|
data.type = "hidden";
|
|
|
|
data.name = "userImg";
|
|
|
|
data.value = profile.getImageUrl();
|
|
|
|
postForm.appendChild(data);
|
|
|
|
|
|
|
|
data = document.createElement("input");
|
|
|
|
data.type = "hidden";
|
|
|
|
data.name = "userRole";
|
|
|
|
data.value = "admin";
|
|
|
|
postForm.appendChild(data);
|
|
|
|
|
|
|
|
data = document.createElement("input");
|
|
|
|
data.type = "hidden";
|
|
|
|
data.name = "logIn";
|
|
|
|
data.value = "logIn";
|
|
|
|
postForm.appendChild(data);
|
|
|
|
|
|
|
|
document.body.appendChild(postForm);
|
|
|
|
postForm.submit();
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function signOut() {
|
|
|
|
var auth2 = gapi.auth2.getAuthInstance();
|
|
|
|
auth2.signOut().then(function () {
|
|
|
|
console.log('User signed out.');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
2018-06-07 21:50:55 +00:00
|
|
|
</html>
|