Controller for cross-domain iframes added

This commit is contained in:
2019-06-19 10:09:46 +00:00
parent e3405369ca
commit 0675ad8512
5 changed files with 71 additions and 31 deletions

View File

@ -31,11 +31,34 @@ $(document).ready(function(){
'color': '#FFF'
});
if (data.CrossDomainLogin) {
// Create iframes for other domains
console.log('CrossDomainLogin initiated');
// do ajax in parallel, show progress,
// redirect once all finished loading or timeout after $X ms
// origin domain should be exempted from timeout
// (because origin domain can/will be different from current domain --due to traefik design).
var cookieDomains = JSON.parse(data.CookieDomains);
var XHR = [];
cookieDomains.forEach(function(domain) {
XHR.push($.get({
url: "https://auth." + domain + "/lucidAuth.setXDomainCookie.php",
crossDomain: true,
data: {
ref: btoa(JSON.stringify({
action: 'login',
token: data.SecureToken
}))
}
}));
});
$.when.apply($, XHR).then(function(){
$.each(arguments, function(_index, arg) {
console.log(JSON.stringify(arg));
});
});
}
console.log("Navigating to :" + data.Location);
window.location.replace(data.Location);
// Finished (either succesfully or through timeout) cross-domain logins
//window.location.replace(data.Location);
}, 2250);
} else {
$('#btnlogin').css({