-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
269 lines (249 loc) · 7.46 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
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
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CoAce login</title>
<link
href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
href="http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css"
rel="stylesheet"
/>
<link rel="stylesheet" type="text/css" href="css/htmleaf-demo.css" />
<style type="text/css">
.form-bg {
padding: 2em 0;
}
.form-horizontal {
background: #fff;
padding-bottom: 40px;
border-radius: 15px;
text-align: center;
}
.form-horizontal .heading {
display: block;
font-size: 35px;
font-weight: 700;
padding: 35px 0;
border-bottom: 1px solid #f0f0f0;
margin-bottom: 30px;
}
.form-horizontal .form-group {
padding: 0 40px;
margin: 0 0 25px 0;
position: relative;
}
.form-horizontal .form-control {
background: #f0f0f0;
border: none;
border-radius: 20px;
box-shadow: none;
padding: 0 20px 0 45px;
height: 40px;
transition: all 0.3s ease 0s;
}
.form-horizontal .form-control:focus {
background: #e0e0e0;
box-shadow: none;
outline: 0 none;
}
.form-horizontal .form-group i {
position: absolute;
top: 12px;
left: 60px;
font-size: 17px;
color: #c8c8c8;
transition: all 0.5s ease 0s;
}
.form-horizontal .form-control:focus + i {
color: #00b4ef;
}
.form-horizontal .fa-question-circle {
display: inline-block;
position: absolute;
top: 12px;
right: 60px;
font-size: 20px;
color: #808080;
transition: all 0.5s ease 0s;
}
.form-horizontal .fa-question-circle:hover {
color: #000;
}
.form-horizontal .main-checkbox {
float: left;
width: 20px;
height: 20px;
background: #11a3fc;
border-radius: 50%;
position: relative;
margin: 5px 0 0 5px;
border: 1px solid #11a3fc;
}
.form-horizontal .main-checkbox label {
width: 20px;
height: 20px;
position: absolute;
top: 0;
left: 0;
cursor: pointer;
}
.form-horizontal .main-checkbox label:after {
content: "";
width: 10px;
height: 5px;
position: absolute;
top: 5px;
left: 4px;
border: 3px solid #fff;
border-top: none;
border-right: none;
background: transparent;
opacity: 0;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.form-horizontal .main-checkbox input[type="checkbox"] {
visibility: hidden;
}
.form-horizontal
.main-checkbox
input[type="checkbox"]:checked
+ label:after {
opacity: 1;
}
.form-horizontal .text {
float: left;
margin-left: 7px;
line-height: 20px;
padding-top: 5px;
text-transform: capitalize;
}
.form-horizontal .btn {
float: right;
font-size: 14px;
color: #fff;
background: #00b4ef;
border-radius: 30px;
padding: 10px 25px;
border: none;
text-transform: capitalize;
transition: all 0.5s ease 0s;
}
@media only screen and (max-width: 479px) {
.form-horizontal .form-group {
padding: 0 25px;
}
.form-horizontal .form-group i {
left: 45px;
}
.form-horizontal .btn {
padding: 10px 20px;
}
}
</style>
</head>
<body>
<div class="htmleaf-container">
<header class="htmleaf-header">
<h1>CoAce: Multi-user Collaboration on Ace</h1>
<div class="htmleaf-links">
<a
class="htmleaf-icon icon-htmleaf-home-outline"
href="https://ace.c9.io/"
title="ace主页"
target="_blank"
></a>
<a
class="htmleaf-icon icon-htmleaf-arrow-forward-outline"
href="http://www.htmleaf.com/css3/ui-design/201703154403.html"
title="作者主页"
target="_blank"
></a>
</div>
</header>
<div class="demo form-bg">
<div class="container">
<div class="row">
<div class="col-md-offset-3 col-md-6">
<form class="form-horizontal">
<span class="heading">Login</span>
<div class="form-group">
<input
type="text"
class="form-control"
id="inputEmail3"
placeholder="input a username"
/>
</div>
<div class="form-group">
<!-- 这里type不要用submit 会刷新页面丢失调试信息 -->
<button id="submit" type="button" class="btn btn-default">
submit
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="/lib/jquery.min.js"></script>
<script>
//try to get session id from url
console.log("this url: ", window.location.href);
let thisUrl = window.location.href;
let url = "/login";
let args = thisUrl.split("?")[1];
if (args != undefined) {
let sessionId = args.split("=")[1];
console.log(" sessionId : ", sessionId);
if (sessionId != undefined) {
url = "/login?sessionId=" + sessionId;
}
}
$("#submit").click(function () {
console.log("login ~");
let user = $("#inputEmail3").val();
localStorage.setItem("user", user);
//console.log(" local user: "+ localStorage.getItem("user"));
$.ajax({
type: "post",
url: url,
data: {
user: user,
},
dataType: "json",
async: false,
beforeSend: function (request) {
request.setRequestHeader("Set-cookie", "SameSite = None; Secure;");
},
success: function (data) {
console.log(" login success! data: " + data);
localStorage.removeItem("sessionId");
localStorage.setItem("sessionId", data["id"]);
window.location.href = "/SText?mode=redirect";
},
error: function (xhr, textStatus, errorThrown) {
console.log("进入error---");
console.log("状态码:" + xhr.status);
console.log("状态:" + xhr.readyState); //当前状态,0-未初始化,1-正在载入,2-已经载入,3-数据进行交互,4-完成。
console.log("错误信息:" + xhr.statusText);
console.log("返回响应信息:" + xhr.responseText); //这里是详细的信息
console.log("请求状态:" + textStatus);
console.log(errorThrown);
console.log("请求失败");
alert("session id invalid! please input another one~");
},
complete: function (xhr, textStatus) {
console.log("complete redirect to asts~");
},
});
});
</script>
</body>
</html>