summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-09-30 18:32:05 +0200
committerTimotej Lazar <timotej.lazar@araneo.org>2015-09-30 18:32:05 +0200
commit5ad56dfc6e8ababaa61c69265a30a95a7772e995 (patch)
tree8c0720c81d303c0d426f72279f5f9b019069d12a
parentbb2636b3f3c669d1f6dcbc891c7770bb12fa26f1 (diff)
Submit login form on enter key
-rw-r--r--js/codeq/login.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/js/codeq/login.js b/js/codeq/login.js
index 6f9a7e7..7db2c8c 100644
--- a/js/codeq/login.js
+++ b/js/codeq/login.js
@@ -33,11 +33,18 @@
$('#disabled').css('display', 'none');
})
.done();
- };
+ },
+ formInputs = $('#username').add('#password');
+
codeq.globalStateMachine.register('login',{
'enter': function(){
$('#signed-in-title').html('');
$("#submit").on('click', loginFun);
+ formInputs.on('keyup', function (ev) {
+ if ((ev.keyCode || ev.which) == 13) {
+ $('#submit').trigger('click');
+ }
+ });
$('#modalLogIn').modal();
$("#screen_login").css('display', '');
@@ -45,6 +52,7 @@
},
'exit' : function(){
$("#submit").off('click', loginFun);
+ formInputs.off('keyup');
$("#screen_login").css('display', 'none');
$('#signed-in-title').html('Signed in as '+$('#username').val());
$("#password").val('');