Skip to content

A self-hosted dashboard that puts all your feeds in one place

Add allow login with enter button

Le Trong Kha3b89602a0177
diff --git a/internal/glance/static/js/login.js b/internal/glance/static/js/login.js
index e077fe9..13decdc 100644
--- a/internal/glance/static/js/login.js
+++ b/internal/glance/static/js/login.js
@@ -70,6 +70,18 @@ function enableLoginButtonIfCriteriaMet() {
);
}
+function handleKeydown(event) {
+ if (event.key === "Enter") {
+ const isDisabled = loginButton.disabled;
+ if (!isDisabled) {
+ handleLoginAttempt();
+ }
+ }
+}
+
+usernameInput.on("keydown", handleKeydown);
+passwordInput.on("keydown", handleKeydown);
+
usernameInput.on("input", enableLoginButtonIfCriteriaMet);
passwordInput.on("input", enableLoginButtonIfCriteriaMet);