Allow 'Enter' key to run Verify Credentials user check
authoredoceo <code@edoceo.com>
Thu, 8 Nov 2012 04:08:27 +0000 (20:08 -0800)
committerBen Shum <bshum@biblio.org>
Mon, 10 Dec 2012 21:31:57 +0000 (16:31 -0500)
In both the "Verify Credentials" menu and "Test Password" patron account
option, this change checks for the keypress of "Enter" and then executes
the cmd_verify routine.

Additionally, the password field is blanked after each attempt.

Signed-off-by: edoceo <code@edoceo.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/xul/staff_client/server/main/verify_credentials.js

index 3d2a484..03193c7 100644 (file)
@@ -65,7 +65,6 @@ function verify_init() {
                         )
                     );
 
                         )
                     );
 
-
                 } catch(E) {
                     alert(E);
                 }
                 } catch(E) {
                     alert(E);
                 }
@@ -74,6 +73,7 @@ function verify_init() {
                 } else {
                     document.getElementById('name_prompt').focus();
                 }
                 } else {
                     document.getElementById('name_prompt').focus();
                 }
+                document.getElementById('password_prompt').value = '';
             },
             false
         );
             },
             false
         );
@@ -111,6 +111,14 @@ function verify_init() {
             document.getElementById('name_prompt').focus();
         }
 
             document.getElementById('name_prompt').focus();
         }
 
+        document.getElementById('password_prompt').addEventListener('keypress',function(e) {
+            if ( e.keyCode && (e.keyCode == 13 || e.keyCode == 77)) {
+                var x = document.createEvent('Event');
+                x.initEvent('command',true,false);
+                document.getElementById('cmd_verify').dispatchEvent(x);
+            }
+        });
+
     } catch(E) {
         alert(E);
     }
     } catch(E) {
         alert(E);
     }