1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 04:06:47 +00:00
webvirtcloud/static/js/login_form.js
catborise 393aecb8f1 refactor(templates): the shared page scripts load from static files
A step towards a Content-Security-Policy without inline scripts. The
scripts every page or many pages share now load from static files: the
error focus of base.html, the please-wait dialog, the sign-in forms'
password toggle and busy button, the jobs pages' reload while a job
runs, and the start of the job panel and of the VM list's state poll,
whose values come as json_script data. Cancel links go back through a
data-history-back attribute instead of a javascript: URL. The IE8
html5shiv/respond.js block, X-UA-Compatible and shrink-to-fit are gone:
no supported browser reads them.
2026-11-02 08:47:58 +03:00

19 lines
933 B
JavaScript

// The sign-in forms (login, OTP login): the eye button shows or hides the
// password; while the form is sent, its button is disabled and says so.
document.getElementById("btn-toggle-pwd").addEventListener("click", function () {
var password = document.getElementById("id_password");
var shown = password.type === "password";
password.type = shown ? "text" : "password";
var icon = document.getElementById("toggle-icon");
icon.classList.toggle("bi-eye", !shown);
icon.classList.toggle("bi-eye-slash", shown);
});
document.getElementById("form-signin").addEventListener("submit", function () {
var button = document.getElementById("btn-signin");
button.disabled = true;
var spinner = document.createElement("span");
spinner.className = "spinner-border spinner-border-sm me-2";
spinner.setAttribute("aria-hidden", "true");
button.replaceChildren(spinner, button.dataset.busyText);
});