🗝
summary refs log tree commit diff
path: root/nginx/handoff.html
blob: c1605809bbd3598424fbdcaa632a2dc3057f15b5 (plain) (blame)
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
<!DOCTYPE html>
<html style="align-items: center; background-color: darkcyan; display: flex; height: 100%">
	<head>
		<title>Handoff</title>
		<script>
			(async () => {
				const response = await fetch("https://dissociate.mia.jetzt/handoff", { credentials: "include" });
				if (response.status == 200) {
					const data = await response.json();
					if (data.expiresIn < 300) {
						console.log("token expiring soon, reauthenticating");
						location = "https://dissociate.mia.jetzt/logout";
					}
					await fetch(`/.nginx/cookie?token=${data.token}&max_age=${data.expiresIn - 60}`);
					location = "/";
				} else {
					console.log("not authenticated, redirecting");
					location = "https://dissociate.mia.jetzt/login";
				}
			})()
		</script>
	</head>
	<body style="background-color: whitesmoke; color: black; filter: drop-shadow(0.5em 0.7em); margin: auto; padding: 1em">
		<p style="font-family: serif; font-size: large; margin: 0">Performing authenticated handoff</p>
	</body>
</html>