-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.html
More file actions
50 lines (45 loc) · 1.24 KB
/
welcome.html
File metadata and controls
50 lines (45 loc) · 1.24 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Verification</title>
<style>
html, body{
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>Verifying your email...</h1>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
const hash = window.location.hash;
const token = new URLSearchParams(hash.substring(1)).get('access_token');
if (token) {
console.log(token);
fetch('/auth/verify', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ token })
})
.then(response => response.json())
.then(data => {
if (data.error) {
document.body.innerHTML = `<h1>Error: ${data.error}</h1>`;
} else {
document.body.innerHTML = `<h1>${data.message}</h1>`;
}
})
.catch(error => {
document.body.innerHTML = `<h1>Error: ${error.message}</h1>`;
});
} else {
document.body.innerHTML = '<h1>No access token found!</h1>';
}
});
</script>
</body>
</html>