-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
136 lines (124 loc) · 4.65 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<style>
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
}
.form-signin {
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
height: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.form-select-device {
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
</style>
</head>
<body>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="container">
<form class="form-signin" id="signin">
<h2 class="form-signin-heading">iCloud Credentials</h2>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus value="{{ credential.email }}" name="inputEmail">
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required value="{{ credential.password }}" name="inputPassword">
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
<form class="form-signin" id="selectDevice">
{% include 'devices.html' %}
</form>
<form class="form-signin" id="testDevice">
{% if not login_failed %}{% include 'testdevice.html' %}{% endif %}
</form>
</div> <!-- /container -->
<script>
// this is the id of the form
$("#signin").submit(function(e) {
var url = "/credential"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#signin").serialize(), // serializes the form's elements.
success: function(data)
{
$("#selectDevice").empty();
$("#testDevice").empty();
$("#selectDevice").append(data);
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
$("#selectDevice").submit(function(e) {
var url = "/device"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#selectDevice").serialize(), // serializes the form's elements.
success: function(data)
{
$("#testDevice").empty();
$("#testDevice").append(data);
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
$("#testDevice").submit(function(e) {
var url = "/test"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
success: function(data)
{
alert(data);
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
</script>
</body>
</html>