WebHostal/war/index.html

153 lines
4.7 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home - Hotel Service</title>
<link type="text/css" rel="stylesheet" href="./css/Diseno.css">
<link type="text/css" rel="stylesheet" href="./css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
<style>
#mainHeader{
background: url('http://www.hotelimperialeroma.it/data/mobile/hotel-imperiale-roma-camere-01-2.jpg') no-repeat local center;
height: 40%;
text-align: center;
padding: 100px;
background-size: 100%;
overflow: hidden;
transition: opacity 500ms, max-height 250ms,padding 500ms;
}
body{
margin: 0;
padding: 0;
background-color: white;
font-family: Roboto, serif;
}
</style>
<script src="https://apis.google.com/js/platform.js" async defer></script>
</head>
<body>
<div id="mainHeader">
<h1 style="font-size: 50px; color: white; display: inline; font-weight: bold; font-family: 'Product Sans',serif">Hotel Services</h1>
</div>
<nav style="background-color: #67c9b3">
<div class="nav-wrapper">
<a href="./" class="brand-logo" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif">Hotel Services</a>
</div>
</nav>
<br />
<div class="container">
<div style="font-size: x-large">
<span id="mainText">Welcome! Log In to Start</span>
<br />
<br />
<div style="font-size: large">
With Google:
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<br />
<br />
Or with your email:<br />
<form id="sigInForm" method="post" action="/users/add" onsubmit="return validate()">
<script>
function validate() {
var email = document.forms['sigInForm']['userEmailForm'].value;
document.forms['sigInForm']['userNameForm'].value = email.substring(0,email.search('@'));
}
</script>
<input id="userEmailForm" name="userEmail" placeholder="email" type="email" required><br />
<input id="userNameForm" name="userName" type="hidden">
<input name="userImg" type="hidden" value="https://i.stack.imgur.com/34AD2.jpg">
<input name="userRole" type="hidden" value="User">
<input name="action" type="hidden" value="logIn">
<button class="btn waves-effect waves-light" type="submit" name="action">Log In
<i class="material-icons right">send</i>
</button>
</form>
</div>
</div>
<br />
<hr />
Developed by:<br />
Fernando Araoz, 20173373<br />
Jose Rodriguez, 20101650<br />
Gustavo Turpo, 20173374<br />
</div>
<script>
"use strict";
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
document.getElementById("mainText").innerText = "Logged In. Redirecting...";
document.getElementById("mainHeader").style.maxHeight = "0";
document.getElementById("mainHeader").style.padding = "0";
setTimeout(function () {
postRedirect("/users/add",{
userEmail : profile.getEmail(),
userName : profile.getName(),
userImg : profile.getImageUrl(),
userRole : "admin",
action : "logIn"
});
},500);
}
function postRedirect(url, postData){
var postForm = document.createElement("form");
postForm.action = url;
postForm.method = "POST";
postForm.style.display = "none";
for (var key in postData){
if (postData.hasOwnProperty(key)){
var input = document.createElement("input");
input.type = "hidden";
input.name = key;
input.value = postData[key];
postForm.appendChild(input);
}
}
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>