-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.js
49 lines (41 loc) · 1.13 KB
/
request.js
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
/** Origin is string - either "index" or "join" */
async function redir(origin, password) {
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Origin", "https://bit.camp");
var raw = JSON.stringify({ origin: origin, password: password });
var requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow",
};
const resp = await fetch(
"https://fcuouabkea.execute-api.us-east-1.amazonaws.com/default/alumRedir",
requestOptions
);
const text = await resp.text();
try {
new URL(text);
window.location.replace(text);
} catch (_) {}
}
function onBlur() {
document.getElementById("pw-form").classList.remove("active");
}
function onFocus() {
document.getElementById("pw-form").classList.add("active");
}
function onInput() {
const val = document.getElementById("pass").value;
if (val.length > 0) {
document.getElementById("submit").classList.add("active");
} else {
document.getElementById("submit").classList.remove("active");
}
}
function onKeyPress(e) {
if (e.keyCode == 13) {
onSubmit();
}
}