Repository navigation
Expand file tree
/
Copy pathsync.html
More file actions
122 lines (100 loc) · 2.81 KB
/
Copy pathsync.html
File metadata and controls
122 lines (100 loc) · 2.81 KB
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
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://mcbcode.com/theme/site.css">
<link rel="icon" href="https://mcbcode.com/theme/favicon.png">
<title>mcbCode | Mobile Sync</title>
<style>
h2 {
color: #ffffff;
font-size: 50px;
}
p {
color: #bebebe;
}
#code {
border: 3px solid #565656;
background-color: #343434;
color: #ffffff;
font-size: 50px;
max-width: 50%;
font-family: 'mcfont' !important;
outline: none;
letter-spacing: 5px;
transition: all 0.2s ease-in-out;
}
#code:focus {
border-radius: 16px;
border-color: #05ee93;
}
button {
padding: 8px;
font-size: 40px;
background-color: #05ee93;
border: 3px solid #00a459;
outline: none;
font-family: 'mcfont';
transition: all 0.2s ease-in-out;
}
button:hover {
color: #ffffff;
background-color: #00a459;
border-color: #05ee93;
border-radius: 16px;
cursor: pointer;
}
img {
image-rendering: pixelated;
}
</style>
</head>
<body style="text-align: center; margin-top: 80px;">
<h2>mcb<span style="color: #05ee93">Code</span> Sync</h2>
<p>sync the mcbCode app with your account.</p>
<p style="color: #ffcc00; font-size: 24px;"><img src="https://mcbcode.com/img/icons/warning.png" style="height: 24px;"> you must be signed in</p>
<p style="font-size: 24px;">don't have an account? sign up <a href="https://mcbcode.com/account" style="color: #05ee93; text-decoration: none;">here</a>
</p>
<br>
<input
id="code"
maxlength="4"
spellcheck="false"
style="text-align:center;"
placeholder="1234"
/>
<br><br><br><br>
<button onclick="approve()">Confirm</button>
<p id="msg"></p>
<script>
// get the code directly after the ?
const query = window.location.search.substring(1);
if (/^\d{4}$/.test(query)) {
document.getElementById("code").value = query;
}
async function approve() {
const code = document.getElementById("code").value.trim();
const msg = document.getElementById("msg");
if (!/^\d{4}$/.test(code)) {
msg.textContent = "Please enter a valid 4-digit code.";
return;
}
try {
const res = await fetch("https://auth.mcbcode.com/auth/device/approve", {
method: "POST",
credentials: "include",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ code })
});
const data = await res.json();
msg.textContent = res.ok
? "Device connected! You can close this."
: (data.error || "Something went wrong.");
} catch (error) {
msg.textContent = "Could not connect to the auth server.";
}
}
</script>
</body>
</html>