-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.html
67 lines (58 loc) · 2.41 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Visdom Login</title>
<!-- Bootstrap core CSS -->
<link href={{ static_url("css/bootstrap.min.css") }} rel="stylesheet">
<!-- Custom styles for this template -->
<link href={{ static_url("css/login.css") }} rel="stylesheet">
<!-- jQuery -->
<script src={{ static_url("js/jquery.min.js") }}></script>
<!-- Hashing Password using Stanford Javascript Crypto Library-->
<script src={{ static_url("js/sjcl.js") }}></script>
<script>
$(document).ready(function () {
// initialize the viewer
$('#submitButton').click(function (event) {
var username = $("#inputUsername").val();
var password = $("#inputPassword").val();
password = sjcl.hash.sha256.hash(password)
var data =
{
username: username,
password: sjcl.codec.hex.fromBits(password)
};
var dataToSend = JSON.stringify(data);
$.ajax(
{
url: '/',
type: 'POST',
data: dataToSend,
success:function() {
window.location.replace("/")
},
error: function () {
$("#errorMessage").text("Invalid Login Information");
}
});
event.preventDefault();
});
});
</script>
</head>
<body class="text-center">
<form class="form-signin">
<h1 class="h3 mb-3 font-weight-normal">Visdom Login</h1>
<label for="inputUsername" class="sr-only">Email address</label>
<input name=username type="username" id="inputUsername" class="form-control" placeholder="Username" required autofocus>
<label for="inputPassword" class="sr-only">Password</label>
<input name=password type="password" id="inputPassword" class="form-control" placeholder="Password" required>
<button class="btn btn-lg btn-primary btn-block" type="submit" id="submitButton" >Login</button>
<p id="errorMessage"></p>
</form>
</body>
</html>