UNPKG

@enfo/marvin

Version:

Marvin, your friendly, slightly paranoid, CLI robot here to cater to all your developing needs

59 lines (50 loc) 1.88 kB
<!DOCTYPE html> <html> <head> <title>Marvin Authorizer</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div id="root" class="aligner"> <div style="flex: 1">&nbsp;</div> <div style="align-content: center"> <img src="images/marvin.png" id="marvin" class="marvin marvin-spinner"/> </div> <div id="content" style="flex: 1">Verifying authorization code...</div> </body> <script> const parameters = new URLSearchParams(window.location.search); const code = parameters.get("code"); window.history.pushState({}, document.title, "/"); window.onload = function() { const xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function(event) { if (this.readyState === 4) { const body = JSON.parse(this.response); const content = document.getElementById("content"); if (this.status === 200) { document.body.style.background = "#ddffd6"; content.innerHTML = "- \"" .concat("Thank you ") .concat(body.firstname) .concat(" ") .concat(body.surname) .concat(" you are now authorized!") .concat("\""); } else if (this.status !== 200) { document.body.style.background = "#fcf0f0"; content.innerHTML = "!! ".concat(body.message).concat(" !!"); } const element = document.getElementById("marvin"); element.classList.remove("marvin-spinner"); // Close session xhttp.onreadystatechange = null; // Do not do a callback (to this function) this.open("DELETE", "http://localhost:5151", true); this.send(); }; } xhttp.open("POST", "http://localhost:5151", true); xhttp.send(code); }; </script> </html>