diff options
Diffstat (limited to 'js/codeq')
-rw-r--r-- | js/codeq/login.js | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/js/codeq/login.js b/js/codeq/login.js index 5f6aa4c..ff217c5 100644 --- a/js/codeq/login.js +++ b/js/codeq/login.js @@ -25,8 +25,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ jqNavBarRight = $('.nav.navbar-nav.navbar-right'), jqNavigationHomeBtn = $('#navigation-home'), jqAAILoginBtn = $('#aai_login_button'), + jqLoginForm = $('#login-form'), jqSignupBtn = $('#signup_button'), - jqSubmitLoginBtn = $("#submit"), jqLangSelect = jqScreen.find('.lang-select'), jqDisabledOverlay = $('#disabled'), jqLoginFailed = jqScreen.find('.login-failed'); @@ -61,7 +61,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ codeq.globalStateMachine.transition('language'); }; - var loginFun = function(){ + var loginFun = function() { jqLoginFailed.hide(); codeq.comms.connect() .then(function () { @@ -72,8 +72,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ jqLoginFailed.show(); }) .done(); - }, - formInputs = $('#username, #password'); + }; codeq.globalStateMachine.register('login',{ 'jqScreen': jqScreen, @@ -87,23 +86,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ codeq.samlLogin = false;//remove saml login flag $('.saml-login-hide').css('display','');//if we login the normal way we want to show the change password buttons. if we enter the saml login they will be hidden - //setup the signup button - jqSignupBtn.on('click', function(e){ - codeq.globalStateMachine.transition('signup'); + // setup login form + jqLoginForm.on('submit', function (e) { e.preventDefault(); + loginFun(); }); - //setup the AAI login btn + // setup the AAI login btn jqAAILoginBtn.on('click',function(e){ codeq.globalStateMachine.transition('aailogin'); e.preventDefault(); }); - jqSubmitLoginBtn.on('click', loginFun); - formInputs.on('keyup', function (ev) { - if ((ev.keyCode || ev.which) == 13) { - jqSubmitLoginBtn.trigger('click'); - } + // setup the signup button + jqSignupBtn.on('click', function(e){ + codeq.globalStateMachine.transition('signup'); + e.preventDefault(); }); - // setup language selection links jqLangSelect.on('click', function (e) { codeq.setLang($(this).data('lang')); @@ -115,8 +112,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ }, 'exit' : function(){ //remove the listener from the buttons specific to this page - jqSubmitLoginBtn.off('click', loginFun); - formInputs.off('keyup'); + jqLoginForm.off('submit'); jqSignupBtn.off('click'); jqAAILoginBtn.off('click'); jqLangSelect.off('click'); |