index.html provisional. Lo uso para probar mis recursos. Uds. usenlo para lo que necesiten, una vez se termine el backend, recien se hará el frontend.

master
Araozu 2018-06-11 21:53:47 -05:00
parent 3297b3814a
commit 0c1397f770
1 changed files with 82 additions and 24 deletions

View File

@ -1,27 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
<!-- above set at the top of the file will set -->
<!-- the browser's rendering engine into -->
<!-- "Quirks Mode". Replacing this declaration -->
<!-- with a "Standards Mode" doctype is supported, -->
<!-- but may lead to some differences in layout. -->
<html>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Hello App Engine</title>
<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>Hello App Engine!</h1>
<table>
<tr>
<td colspan="2" style="font-weight:bold;">Available Servlets:</td>
</tr>
<tr>
<td><a href="lab09">Lab09</a></td>
</tr>
</table>
<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>
</html>