-
Notifications
You must be signed in to change notification settings - Fork 2
/
login.html
443 lines (374 loc) · 15.1 KB
/
login.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Daakiya - Route Optimization and Delivery Management</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link href="./css/bootstrap-theme.min.css" rel="stylesheet"/>
<link href="css/theme.css" rel="stylesheet"/>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="icon" href="./img/favicon-d.png">
</head>
<html>
<body style="padding-bottom: 0px">
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Daakiya</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#" onclick="showLoginForm()">Sign In</a></li>
<li><a href="#" onclick="showRegisterForm()">Register</a></li>
<!-- <li class="dropdown">-->
<!-- <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>-->
<!-- <ul class="dropdown-menu">-->
<!-- <li><a href="#">Action</a></li>-->
<!-- <li><a href="#">Another action</a></li>-->
<!-- <li><a href="#">Something else here</a></li>-->
<!-- <li role="separator" class="divider"></li>-->
<!-- <li class="dropdown-header">Nav header</li>-->
<!-- <li><a href="#">Separated link</a></li>-->
<!-- <li><a href="#">One more separated link</a></li>-->
<!-- </ul>-->
<!-- </li>-->
</ul>
<!-- <ul class="nav navbar-nav" style="float: right;">-->
<!-- <li><a href="#" class="navbar-nav" style="margin-right: 30px;">Sign In</a></li>-->
<!-- <li><a href="#" class="navbar-nav" style="margin-right: 30px;">Register</a></li>-->
<!-- </ul>-->
</div><!--/.nav-collapse -->
</div>
</nav>
<style type="text/css">
.thumbnail {
padding: 4px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
display: inline-block;
max-width: 100%;
height: auto;
box-shadow: 0 1px 2px rgba(0,0,0,.075);
}
.header {
margin-top: -19px;
margin-bottom: 0px;
background: linear-gradient(45deg, #083100 0%, #336d61 100%);
background: linear-gradient(45deg, #0e1d0c 0%, #335a6d 100%);
box-shadow: 0px 8px 31px 0px #0e0b0b96 inset;
padding-top: 28px;
padding-bottom: 28px;
color: #ececec;
text-shadow: 1px 1px 1px #000;
/*background: #EEE;*/
}
/*.signUpForm {*/
/* margin-top: 0px;*/
/* background: #EEE;*/
/* color: #000;*/
/* text-shadow: none;*/
/* box-shadow: 0px 0px 13px #000 inset;*/
/* padding: 35px;*/
/*}*/
.header .dropdown-menu {
text-shadow: 0px 0px 0px #000;
}
.sidebar {
font-family: 'Raleway', sans-serif;
padding: 1em 2em;
font-size: 18px;
/*background: #222;*/
color: #EEE;
}
h1,h2 {
font-weight: 200;
margin: 0.4em 0;
}
h1 { font-size: 3.5em; }
h2 {
color: #CCC;
font-size: 2em;
}
</style>
<div class="header">
<div style="
background: url(frontpage-image-pattern.png) repeat center center;
margin-top: -33px;
margin-botton: 0px;
padding-top: 27px;
padding-bottom: 27px;">
<div class="container">
<div class="">
<div class="row">
<div class="col-xs-12 col-md-12 col-lg-8">
<div class="sidebar" style="margin-top: 59px;">
<link href="https://fonts.googleapis.com/css?family=Raleway:200,100,400" rel="stylesheet" type="text/css" />
<!-- <button type="button" class="btn btn-default"><span>Sign in with Github </span><img src="github.svg"/> </button>-->
<!-- <button type="button" class="btn btn-default"><span>Sign up with Facebook </span><img src="facebook.svg"/> </button>-->
<br/>
<h3>Daakiya helps you find your shortest path between locations.</h3>
<div class="hidden-xs"><h1>One stop solution to<br/>
<span
class="txt-rotate"
data-period="2000"
data-rotate='[ "Route Optimization.", "Delivery Management.", "Saving Logistics Costs." ]'></span>
</h1></div>
<h2></h2>
</div>
</div>
<div class="col-xs-12 col-md-12 col-lg-4" style="margin-top: 0px;
background: #EEE;
color: #000;
text-shadow: none;
box-shadow: 0px 2px 7px #000 inset;
padding: 35px;
border-radius: 12px;
height: 515px;
border: 1px solid #000;">
<!-- -->
<form class="loginForm" style="">
<h2 style="
font-family: 'Raleway', sans-serif;
color:#000;
margin-top: 79px;
margin-bottom: 27px;">Sign in <button type="button" class="btn btn-default" onclick="authenticateWithGoogle()"><span>Sign in with Google </span><img src="img/google.svg"/> </button></h2>
<div class="form-group">
<label>Email address</label>
<input type="email" class="form-control" id="inputEmail" aria-describedby="emailHelp" placeholder="Enter email">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" id="inputPassword" placeholder="Password">
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1">
<label class="form-check-label" for="exampleCheck1">Remember Me</label>
</div>
<button type="button" class="btn btn-primary" onclick="loginForm()">Login</button>
<!-- <button type="submit" class="btn btn-default" onClick="showRegisterForm();">I dont have an account - Register</button>-->
<div class="form-group form-check">
<!-- <input type="checkbox" class="form-check-input" id="exampleCheck1">-->
<strong><p class="form-check-label text-center text-danger" style="display: none;" id="errorMessage">Message</p></strong>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div> <!-- /container -->
<script type="text/javascript">
var TxtRotate = function(el, toRotate, period) {
this.toRotate = toRotate;
this.el = el;
this.loopNum = 0;
this.period = parseInt(period, 10) || 2000;
this.txt = '';
this.tick();
this.isDeleting = false;
};
TxtRotate.prototype.tick = function() {
var i = this.loopNum % this.toRotate.length;
var fullTxt = this.toRotate[i];
if (this.isDeleting) {
this.txt = fullTxt.substring(0, this.txt.length - 1);
} else {
this.txt = fullTxt.substring(0, this.txt.length + 1);
}
this.el.innerHTML = '<span class="wrap">'+this.txt+'</span>';
var that = this;
var delta = 300 - Math.random() * 100;
if (this.isDeleting) { delta /= 2; }
if (!this.isDeleting && this.txt === fullTxt) {
delta = this.period;
this.isDeleting = true;
} else if (this.isDeleting && this.txt === '') {
this.isDeleting = false;
this.loopNum++;
delta = 500;
}
setTimeout(function() {
that.tick();
}, delta);
};
window.onload = function() {
var elements = document.getElementsByClassName('txt-rotate');
for (var i=0; i<elements.length; i++) {
var toRotate = elements[i].getAttribute('data-rotate');
var period = elements[i].getAttribute('data-period');
if (toRotate) {
new TxtRotate(elements[i], JSON.parse(toRotate), period);
}
}
// INJECT CSS
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = ".txt-rotate > .wrap { color:#CCC; border-right: 0.08em solid #CCC }";
document.body.appendChild(css);
};
</script>
<!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/6.1.1/firebase-app.js"></script>
<!-- Add Firebase products that you want to use -->
<script src="https://www.gstatic.com/firebasejs/6.1.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.1.1/firebase-firestore.js"></script>
<!--<script src="https://www.gstatic.com/firebasejs/6.1.1/firebase.js"></script>-->
<script src="./accessKeys.js"></script>
<script>
//Check whether user is already signed in?
firebase.auth().onAuthStateChanged(function(user) {
console.log(user)
if (user) {
// User is signed in. navigate to orders list view
window.location.href = "/order_list_view.html";
console.log("User Logged In", user.email);
console.log("window.location.href "+ window.location.href)
} else {
// No user is signed in. stay on the same page
console.log("User Not Logged In");
}
});
async function showRegisterForm (){
//await $(".loginForm").hide();
// await $(".signUpForm").show();
window.location.href = "/index.html";
}
async function showLoginForm (){
//await $(".signUpForm").hide();
//await $(".loginForm").show();
window.location.href = "/login.html";
}
document.getElementById("registerButton").addEventListener("click", function(event){
//event.preventDefault()
//registerUser()
});
$(document).ready( () => {
//
// //e.preventDefault();
// var firebaseConfig = module_firebaseConfig;
// // Initialize Firebase
// firebase.initializeApp(firebaseConfig);
// var auth = firebase.auth();
})
async function loginForm () {
//e.preventDefault();
var firebaseConfig = module_firebaseConfig;
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
const auth = firebase.auth();
let email = document.getElementById("inputEmail").value
let password = document.getElementById("inputPassword").value
console.log("Registering with : "+email+"")
try {
let isLoggedIn = await auth.signInWithEmailAndPassword (email, password);// [email protected] 1231234
console.log(isLoggedIn)
if (isLoggedIn) {
console.log("User logged in...")
window.location.href = "/order_list_view.html";
//window.location.refresh();
}
}catch (e) {
console.log("error: unable to register: ", e)
$("#errorMessage").text(e.message)
$('#errorMessage').show()
}
}
//
// //Check whether user is already signed in?
// firebase.auth().onAuthStateChanged(function(user) {
// console.log(user)
// if (user) {
// // User is signed in. navigate to orders list view
// window.location.href = "/order_list_view.html";
// console.log("User Logged In", user.email);
// console.log("window.location.href "+ window.location.href)
// } else {
// // No user is signed in. stay on the same page
// console.log("User Not Logged In");
// }
// });
//
// async function registerUser () {
// let email = document.getElementById("loginEmail").value
// let password = document.getElementById("loginPassword").value
// console.log("Registering with : "+email+"")
// try {
// let isLoggedIn = await auth.createUserWithEmailAndPassword (email, password);
// console.log(isLoggedIn)
// if (isLoggedIn) {
// console.log("User created...")
// //window.location.refresh();
// }
// }catch (e) {
// console.log("error: unable to register: ", e)
// }
// }
//
function authenticateWithGoogle () {
//e.preventDefault();
var firebaseConfig = module_firebaseConfig;
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
//const auth = firebase.auth();
var provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('https://www.googleapis.com/auth/contacts.readonly');
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
var token = result.credential.accessToken;
console.log(token)
// The signed-in user info.
var user = result.user;
console.log(user)
if (user) {
console.log("User logged in...")
window.location.href = "/order_list_view.html";
//window.location.refresh();
}
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
console.log(errorCode)
var errorMessage = error.message;
console.log(errorMessage)
// The email of the user's account used.
var email = error.email;
console.log(email)
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
console.log(credential)
$("#errorMessage").text(e.message)
$('#errorMessage').show()
});
}
</script>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="./js/vendor/jquery-3.4.1.min.js"><\/script>')</script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/docs.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<svg xmlns="http://www.w3.org/2000/svg" width="1140" height="500" viewBox="0 0 1140 500" preserveAspectRatio="none" style="display: none; visibility: hidden; position: absolute; top: -100%; left: -100%;"><defs><style type="text/css"></style></defs><text x="0" y="57" style="font-weight:bold;font-size:57pt;font-family:Arial, Helvetica, Open Sans, sans-serif">Thirdslide</text></svg></body>
</html>