-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.html
More file actions
executable file
·56 lines (56 loc) · 2.31 KB
/
link.html
File metadata and controls
executable file
·56 lines (56 loc) · 2.31 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Link JagProx Account</title>
</head>
<body>
<h1>Link Your Minecraft Account</h1>
<p id="message"></p>
<form id="linkForm">
<label for="email">JagProx Email:</label><br>
<input type="email" id="email" name="email" required><br>
<label for="password">JagProx Password:</label><br>
<input type="password" id="password" name="password" required><br><br>
<button type="submit">Link Account</button>
</form>
<script>
const API_BASE_URL = 'https://jagprox.jaghack.com/api/v1';
document.getElementById('linkForm').addEventListener('submit', async (event) => {
event.preventDefault();
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
const urlParams = new URLSearchParams(window.location.search);
const code = urlParams.get('code');
const messageElement = document.getElementById('message');
if (!code) {
messageElement.textContent = 'Error: No linking code found in URL.';
messageElement.style.color = 'red';
return;
}
try {
const response = await fetch(`${API_BASE_URL}/complete-link`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password, code }),
});
const data = await response.json();
if (response.ok) {
messageElement.textContent = data.message;
messageElement.style.color = 'green';
} else {
messageElement.textContent = `Error: ${data.message || 'Something went wrong.'}`;
messageElement.style.color = 'red';
}
} catch (error) {
console.error('Network error:', error);
messageElement.textContent = 'Network error. Please try again.';
messageElement.style.color = 'red';
}
});
</script>
</body>
</html>