summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-10-15 14:41:34 +0200
committerRobert Zorko <robertz@gurucue.com>2015-10-15 14:41:34 +0200
commitfeb87a34e3b195d7c204f5d017e108f4f46498e0 (patch)
tree70cb9c1c8d18ef0797f110fbdd6fc8a2357b2ec7 /js
parent9e75e05583b9ae07e86438c63bcc2dc22be05fea (diff)
added the web logic for the saml login, but it still needs testing
Diffstat (limited to 'js')
-rw-r--r--js/codeq/aaiLogin.js32
-rw-r--r--js/codeq/comms.js4
2 files changed, 34 insertions, 2 deletions
diff --git a/js/codeq/aaiLogin.js b/js/codeq/aaiLogin.js
index e6e36ab..6ea49ea 100644
--- a/js/codeq/aaiLogin.js
+++ b/js/codeq/aaiLogin.js
@@ -5,26 +5,54 @@
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', '');
+
+ samlLoginUrl = baseSamlUrl + codeq.comms.getSid();
+ jqAaiIframe.attr('src', samlLoginUrl);
+
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.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'});
}
};
})();