Made aeskeyshare work properly
This commit is contained in:
parent
8299915502
commit
6e87268930
|
@ -1,8 +1,6 @@
|
|||
// Add an event listener to handle incoming messages
|
||||
window.addEventListener("message", function(event) {
|
||||
try {
|
||||
let data = JSON.parse(event.data);
|
||||
const access_token = data["access_token"];
|
||||
const redirect_uri = data["redirect_uri"];
|
||||
const access_token = event.data;
|
||||
|
||||
fetch("https://auth.hectabit.org/api/isloggedin", {
|
||||
method: "POST",
|
||||
|
@ -10,15 +8,10 @@ window.addEventListener("message", function(event) {
|
|||
access_token: access_token
|
||||
})
|
||||
})
|
||||
.then((response) => {
|
||||
.then((response) => function () {
|
||||
if (response.status === 200) {
|
||||
console.log("Key is valid");
|
||||
let newtab = window.open(redirect_uri);
|
||||
newtab.postMessage(localStorage.getItem("DONOTSHARE-password"), "*");
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
} catch {
|
||||
console.log("Error parsing JSON");
|
||||
console.log("Key is valid")
|
||||
window.postMessage(localStorage.getItem("DONOTSHARE-password"), event.origin)
|
||||
}
|
||||
})
|
||||
});
|
|
@ -7,5 +7,5 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<link rel="icon" href="/static/svg/favicon.svg">
|
||||
</head>
|
||||
<p>Redirecting...</p>
|
||||
<p>Sending key...</p>
|
||||
<script src="/static/js/aeskeyshare.js"></script>
|
||||
|
|
Reference in New Issue