mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-27 18:57:35 +00:00
cmd/tailscale/cli: skip new tab on web login
It doesn't work properly. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
parent
047501e899
commit
63d6108899
@ -89,8 +89,7 @@
|
|||||||
<a href="#" class="mb-4 link font-medium js-loginButton" target="_blank">Reauthenticate</a>
|
<a href="#" class="mb-4 link font-medium js-loginButton" target="_blank">Reauthenticate</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</main>
|
</main>
|
||||||
<script>
|
<script>(function () {
|
||||||
(function () {
|
|
||||||
let loginButtons = document.querySelectorAll(".js-loginButton");
|
let loginButtons = document.querySelectorAll(".js-loginButton");
|
||||||
let fetchingUrl = false;
|
let fetchingUrl = false;
|
||||||
|
|
||||||
@ -112,8 +111,6 @@
|
|||||||
nextUrl.search = nextParams.toString()
|
nextUrl.search = nextParams.toString()
|
||||||
const url = nextUrl.toString();
|
const url = nextUrl.toString();
|
||||||
|
|
||||||
const tab = window.open("/redirect", "_blank");
|
|
||||||
|
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@ -128,14 +125,11 @@
|
|||||||
}
|
}
|
||||||
const url = res["url"];
|
const url = res["url"];
|
||||||
if (url) {
|
if (url) {
|
||||||
authUrl = url;
|
document.location.href = url;
|
||||||
tab.location = url;
|
|
||||||
tab.focus();
|
|
||||||
} else {
|
} else {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
tab.close();
|
|
||||||
alert("Failed to log in: " + err.message);
|
alert("Failed to log in: " + err.message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -143,8 +137,7 @@
|
|||||||
Array.from(loginButtons).forEach(el => {
|
Array.from(loginButtons).forEach(el => {
|
||||||
el.addEventListener("click", handleClick);
|
el.addEventListener("click", handleClick);
|
||||||
})
|
})
|
||||||
})();
|
})();</script>
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user