From 5dd793cdaadc0456892673ee70a04df774bae522 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 26 Feb 2016 15:11:13 +0100 Subject: Improve forms --- css/codeq.css | 4 +++ index.html | 93 ++++++++++++++++++++++++++++++++++--------------------- js/codeq/login.js | 28 +++++++---------- 3 files changed, 73 insertions(+), 52 deletions(-) diff --git a/css/codeq.css b/css/codeq.css index cc39ad9..33a4c2f 100644 --- a/css/codeq.css +++ b/css/codeq.css @@ -105,6 +105,10 @@ button.navbar-toggle > span.glyphicon { margin: 0; } +form { + margin-bottom: 0; +} + /* modal screens*/ #screen_login, #screen_signup, #screen_change_pass, #screen_settings, #screen_upgrade_to_aai { padding: 15px 0; diff --git a/index.html b/index.html index c7fdf92..eb8f093 100644 --- a/index.html +++ b/index.html @@ -114,23 +114,25 @@ or -
+
- +
- -
-
- +
+
@@ -171,32 +173,45 @@
- +
- +
- +
- +
- + +
+
+ +
- - - 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 . */ 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 . */ 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 . */ jqLoginFailed.show(); }) .done(); - }, - formInputs = $('#username, #password'); + }; codeq.globalStateMachine.register('login',{ 'jqScreen': jqScreen, @@ -87,23 +86,21 @@ along with this program. If not, see . */ 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 . */ }, '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'); -- cgit v1.2.1