Enter/return key submits form in the new user/password dialog
[citadel.git] / webcit / static / authmethods.js
index 67018a7c2aaef8f59d639bc629f1289b371e5db2..4bb117c61754347bfae5336af1268757eb1e7ea0 100644 (file)
@@ -66,6 +66,23 @@ function ajax_try_username_and_password() {
        });
 }
 
+/*
+ * The user pressed a key while in the username or password box.
+ * Is it the enter/return key?  Submit the form.
+ */
+function username_and_password_onkeypress(e) {
+       if (window.event) {             /* IE */
+               keynum = e.keyCode
+       }
+       else if (e.which) {             /* real browsers */
+               keynum = e.which
+       }
+       if (keynum == 13) {             /* enter/return key */
+               ajax_try_username_and_password();
+       }
+}
+
+
 /*
  * tab handler for the login box
  */