mirror of
https://github.com/glanceapp/glance.git
synced 2025-08-20 04:28:49 +02:00
Update login.js
This commit is contained in:
@@ -70,20 +70,21 @@ function enableLoginButtonIfCriteriaMet() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleKeydown(event) {
|
function handleLoginWithEnter(event) {
|
||||||
if (event.key === "Enter") {
|
if (event.key !== "Enter") return;
|
||||||
const isDisabled = loginButton.disabled;
|
if (loginButton.disabled) return;
|
||||||
if (!isDisabled) {
|
|
||||||
handleLoginAttempt();
|
document.activeElement.blur();
|
||||||
}
|
handleLoginAttempt();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usernameInput.on("keydown", handleKeydown);
|
usernameInput
|
||||||
passwordInput.on("keydown", handleKeydown);
|
.on("input", enableLoginButtonIfCriteriaMet)
|
||||||
|
.on("keydown", handleLoginWithEnter);
|
||||||
|
|
||||||
usernameInput.on("input", enableLoginButtonIfCriteriaMet);
|
passwordInput
|
||||||
passwordInput.on("input", enableLoginButtonIfCriteriaMet);
|
.on("input", enableLoginButtonIfCriteriaMet)
|
||||||
|
.on("keydown", handleLoginWithEnter);
|
||||||
|
|
||||||
async function handleLoginAttempt() {
|
async function handleLoginAttempt() {
|
||||||
state.lastUsername = usernameInput.value;
|
state.lastUsername = usernameInput.value;
|
||||||
|
Reference in New Issue
Block a user