diff options
author | Marko Pušnik <marko.pusnik@guru.si> | 2015-10-15 15:58:18 +0200 |
---|---|---|
committer | Marko Pušnik <marko.pusnik@guru.si> | 2015-10-15 15:58:18 +0200 |
commit | 0374d419b6856e89fe494abe0241a62b163d2cca (patch) | |
tree | 135fecb138398cafbddf0d20d8f92d48a9cf88fe | |
parent | 4738f0cdef0fb52d530748e6d2b62bf0454d8c33 (diff) | |
parent | 6381f087edf1c078aabf6a81ff8d72ebdca64e55 (diff) |
Merge branch 'master' of ssh://212.235.189.51:22122/codeq-web
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | js/codeq/aaiLogin.js | 34 | ||||
-rw-r--r-- | js/codeq/comms.js | 4 |
3 files changed, 37 insertions, 3 deletions
@@ -149,7 +149,7 @@ </div> <div class="container"> <div class="row" style="padding: 0; padding-top: 5px;"> - <iframe width="100%" height="850px" frameborder="0" scrolling="no" allowtransparency="true" src="https://codeq.si/Shibboleth.sso/Login?forceAuthn=1"></iframe> + <iframe width="100%" height="850px" frameborder="0" scrolling="no" allowtransparency="true" src="" id="aai_iframe"></iframe> </div> </div> </div> diff --git a/js/codeq/aaiLogin.js b/js/codeq/aaiLogin.js index e6e36ab..fe7bfc8 100644 --- a/js/codeq/aaiLogin.js +++ b/js/codeq/aaiLogin.js @@ -5,26 +5,56 @@ var jqNavBarRight = $('.nav.navbar-nav.navbar-right'), jqNavigationHomeBtn = $('#navigation-home'), - jqCancelAaiLogin = $("#cancel_aai_login"); + jqCancelAaiLogin = $("#cancel_aai_login"), + jqDisabledOverlay = $('#disabled'), + jqAaiIframe = $('#aai_iframe'), + baseSamlUrl = 'https://codeq.si/Shibboleth.sso/Login?sid=', + samlLoginUrl = ''; codeq.globalStateMachine.register('aailogin',{ 'enter': function(){ + jqDisabledOverlay.css('display', ''); + jqNavigationHomeBtn.off('click');//remove the click listener of this element here jqNavBarRight.css('display','none');//hide settings etc. + //enable the back button jqCancelAaiLogin.on('click',function(){ codeq.globalStateMachine.transition('login'); }); $('#signed-in-title').html(''); $('#screen_aai_login').css('display',''); + + codeq.comms.connect() + .then(function(){ + samlLoginUrl = baseSamlUrl + codeq.comms.getSid(); + jqAaiIframe.attr('src', samlLoginUrl); + return codeq.comms.samlLogin(); + }) + .then(function(data){ + codeq.log.debug(JSON.stringify(data)); + if(data.code !== 0) throw new Error('SAML login failed, code: ' + data.code + ', message: ' + data.message); + codeq.globalStateMachine.transition('language'); + }) + .fail(function(reason){ + codeq.log.error('SAML login failed: ' + reason); + alert('SAML login failed: ' + reason); + }) + .done(); + + jqDisabledOverlay.css('display','none'); }, 'exit' : function(){ //disable site specific listeners + codeq.comms.off('saml_login'); + jqAaiIframe.attr('src','');//lets remove the url jqCancelAaiLogin.off('click'); + samlLoginUrl = ''; $("#screen_aai_login").css('display', 'none'); - //re-enable the click listener + + //re-enable the click listener of the logo jqNavigationHomeBtn.on('click', function(e){ codeq.globalStateMachine.transition('language'); e.preventDefault(); diff --git a/js/codeq/comms.js b/js/codeq/comms.js index e12ffa3..225026b 100644 --- a/js/codeq/comms.js +++ b/js/codeq/comms.js @@ -524,6 +524,10 @@ 'getResourceTree': function () { return ajaxGet(ajaxDataPrefix + 'resources.json'); + }, + + 'samlLogin': function(){ + return this.send({'action':'saml_login'}); } }; })(); |