2024-03-28 17:07:30 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2024-03-28 17:02:52 +00:00
|
|
|
<title>Sending data...</title>
|
2024-03-28 17:07:30 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2024-03-29 11:54:15 +00:00
|
|
|
<p>Sending data...</p>
|
2024-03-28 17:07:30 +00:00
|
|
|
|
|
|
|
<script>
|
2024-04-02 18:43:05 +01:00
|
|
|
if (localStorage.getItem("DONOTSHARE-secretkey") === null) {
|
2024-04-16 16:18:19 +01:00
|
|
|
window.location.replace("/login" + window.location.search)
|
2024-04-02 18:39:08 +01:00
|
|
|
document.body.innerHTML = "Redirecting..."
|
|
|
|
throw new Error();
|
|
|
|
}
|
|
|
|
|
2024-03-29 11:02:22 +00:00
|
|
|
function oauth() {
|
2024-03-31 12:49:09 +01:00
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
2024-03-28 17:07:30 +00:00
|
|
|
|
2024-03-29 11:02:22 +00:00
|
|
|
// Get URL parameters
|
2024-04-02 16:57:19 +01:00
|
|
|
if (urlParams.has('client_id')) {
|
|
|
|
var client_id = urlParams.get('client_id');
|
|
|
|
var redirect_uri = urlParams.get('redirect_uri');
|
|
|
|
var response_type = urlParams.get('response_type');
|
|
|
|
} else {
|
|
|
|
window.location.replace("/dashboard");
|
2024-04-17 10:38:46 +01:00
|
|
|
document.body.innerHTML = "Redirecting..."
|
|
|
|
throw new Error();
|
2024-04-02 16:57:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (urlParams.has('state')) {
|
|
|
|
var state = urlParams.get('state');
|
2024-04-18 13:03:05 +01:00
|
|
|
} else {
|
|
|
|
state = "none"
|
2024-04-02 16:57:19 +01:00
|
|
|
}
|
2024-03-31 12:49:09 +01:00
|
|
|
|
|
|
|
if (urlParams.has('code_challenge')) {
|
|
|
|
code = urlParams.get('code_challenge');
|
|
|
|
codemethod = urlParams.get('code_challenge_method');
|
|
|
|
} else {
|
|
|
|
code = "none"
|
|
|
|
codemethod = "none"
|
|
|
|
}
|
2024-03-28 17:07:30 +00:00
|
|
|
|
2024-03-29 11:02:22 +00:00
|
|
|
// Get DONOTSHARE-secretkey from localStorage
|
|
|
|
var secret_key = localStorage.getItem("DONOTSHARE-secretkey");
|
2024-04-18 13:03:05 +01:00
|
|
|
var now = new Date();
|
|
|
|
var expireTime = now.getTime() + (21 * 1000); // 21 seconds from now
|
|
|
|
var expires = new Date(expireTime).toUTCString();
|
2024-04-18 13:15:36 +01:00
|
|
|
document.cookie = "key=" + secret_key "; expires=" + expires + "; path=/";
|
2024-03-28 17:07:30 +00:00
|
|
|
|
2024-03-29 11:02:22 +00:00
|
|
|
// Send data to example.org using POST request
|
2024-04-18 13:03:05 +01:00
|
|
|
window.location.replace("/api/auth?client_id=" + client_id + "&redirect_uri=" + redirect_uri + "&code_challenge_method=" + codemethod + "&code_challenge=" + code + "&state=" state)
|
2024-03-29 11:02:22 +00:00
|
|
|
}
|
2024-03-29 11:54:15 +00:00
|
|
|
oauth()
|
2024-03-28 17:07:30 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|