Skip to content

Commit

Permalink
on browser error, introduce manual save button
Browse files Browse the repository at this point in the history
  • Loading branch information
isaaguilar committed Apr 25, 2024
1 parent c38baf4 commit 04c1da9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/api/manifests/samlconnecter.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
var statusElement = document.getElementById("status");
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://localhost:18080/connecter?token={{ .Token }}");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Content-Type", "text/plain");

xhr.addEventListener("load", function () {
if (this.status === 200) {
Expand All @@ -19,7 +19,12 @@
});

xhr.addEventListener("error", function(event) {
statusElement.innerHTML = "An error occurred: " + event.message
var token = "{{ .Token }}";
if (token === "") {
statusElement.innerHTML = "An error occurred: " + event.message
} else {
statusElement.innerHTML = "<div>Could not automatically save token. Click to button to complete token downlaod.</div><br /><a href='http://localhost:18080/connecter?token={{ .Token }}&a=true'>Save Token</a><br/><br/>"
}
});

xhr.send(JSON.stringify(data));
Expand Down

0 comments on commit 04c1da9

Please sign in to comment.