mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
feat(accounts): the sign-in page keeps the username, warns of Caps Lock and shows the lock and a notice
A locked user got django-axes' plain-text 429 reply, untranslated and with no way back; it is now a page in the panel's layout that says within how many minutes the lock ends, and leads back to the sign-in page with the destination kept (AXES_LOCKOUT_CALLABLE). A failed sign-in emptied the username; it is kept, the password is marked invalid and has the cursor (a refused username keeps it). A line under the password says when Caps Lock is on. The fields carry autocomplete (username, current-password, one-time-code) for password managers and phones, and the show-password button is reachable with Tab again. The lines under the forms are gone: "KVM / Libvirt" with a green dot looked like a status it did not check, and "2FA Protection Active" was shown to users without 2FA. A new setting, Sign-in notice (Settings, Login), is shown above both sign-in forms when set, e.g. planned maintenance or a terms-of-use line.
This commit is contained in:
parent
67357c844a
commit
5d3280f9ea
16 changed files with 217 additions and 28 deletions
|
|
@ -1,5 +1,6 @@
|
|||
// 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.
|
||||
// password, a line says when Caps Lock is on, and 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";
|
||||
|
|
@ -9,6 +10,17 @@ document.getElementById("btn-toggle-pwd").addEventListener("click", function ()
|
|||
icon.classList.toggle("bi-eye-slash", shown);
|
||||
});
|
||||
|
||||
["keydown", "keyup"].forEach(function (type) {
|
||||
document.getElementById("id_password").addEventListener(type, function (event) {
|
||||
var on = event.getModifierState && event.getModifierState("CapsLock");
|
||||
document.getElementById("caps-lock").classList.toggle("d-none", !on);
|
||||
});
|
||||
});
|
||||
// Caps Lock may change elsewhere: the line waits for the next key here
|
||||
document.getElementById("id_password").addEventListener("blur", function () {
|
||||
document.getElementById("caps-lock").classList.add("d-none");
|
||||
});
|
||||
|
||||
document.getElementById("form-signin").addEventListener("submit", function () {
|
||||
var button = document.getElementById("btn-signin");
|
||||
button.disabled = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue