hostname ≠ ui-domain

We need a additional variable for the mailcow-ui-domain, if the domain used for the mailcow ui differs from the hostname. Otherwise our users will get the login promt, when they try to access the mobileconfig file.
Dieser Commit ist enthalten in:
heavygale 2019-01-26 22:25:49 +01:00
Ursprung 361f75390c
Commit c84381ab5f

Datei anzeigen

@ -3,12 +3,12 @@ if (window.location.href.indexOf('/client/') >= 0) {
function setCookie(name, value) { function setCookie(name, value) {
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + "; path=/"; document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + "; path=/";
} }
function getParameterByName(name) { function getParameterByName(name) {
var match = RegExp('[?#&]' + name + '=([^&]*)').exec(window.location.hash); var match = RegExp('[?#&]' + name + '=([^&]*)').exec(window.location.hash);
return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
} }
/* Store URL variables in cookies */ /* Store URL variables in cookies */
if (getParameterByName('host')) { if (getParameterByName('host')) {
setCookie("host", getParameterByName('host')); setCookie("host", getParameterByName('host'));
@ -21,6 +21,9 @@ if (window.location.href.indexOf('/client/') >= 0) {
if (getParameterByName('name')) { if (getParameterByName('name')) {
setCookie("name", getParameterByName('name')); setCookie("name", getParameterByName('name'));
} }
if (getParameterByName('ui')) {
setCookie("ui", getParameterByName('ui'));
}
if (getParameterByName('port')) { if (getParameterByName('port')) {
setCookie("port", getParameterByName('port')); setCookie("port", getParameterByName('port'));
} }
@ -49,7 +52,7 @@ if (window.location.href.indexOf('/client') >= 0) {
} }
return ""; return "";
} }
/* Hide variable fields if no values are available */ /* Hide variable fields if no values are available */
if (!getCookie('host')) { if (!getCookie('host')) {
Array.prototype.forEach.call(document.getElementsByClassName('client_variables_available'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_variables_available'), function(el) {
@ -60,23 +63,23 @@ if (window.location.href.indexOf('/client') >= 0) {
el.style.display = 'none'; el.style.display = 'none';
}); });
} }
/* Hide the TOC, which might contain hidden content */ /* Hide the TOC, which might contain hidden content */
Array.prototype.forEach.call(document.getElementsByClassName('md-sidebar--secondary'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('md-sidebar--secondary'), function(el) {
el.style.display = 'none'; el.style.display = 'none';
}); });
/* Substitute variables */ /* Substitute variables */
Array.prototype.forEach.call(document.getElementsByClassName('client_var_host'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_host'), function(el) {
el.innerText = getCookie('host'); el.innerText = getCookie('host');
}); });
Array.prototype.forEach.call(document.getElementsByClassName('client_var_link'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_link'), function(el) {
if (!getCookie('host')) { if (!getCookie('ui')) {
el.href = '#'; el.href = '#';
} else if (getCookie('port') != '443') { } else if (getCookie('port') != '443') {
el.href = 'https://' + getCookie('host') + ':' + getCookie('port') + '/' + el.getAttribute("href"); el.href = 'https://' + getCookie('ui') + ':' + getCookie('port') + '/' + el.getAttribute("href");
} else { } else {
el.href = 'https://' + getCookie('host') + '/' + el.getAttribute("href"); el.href = 'https://' + getCookie('ui') + '/' + el.getAttribute("href");
} }
}); });
Array.prototype.forEach.call(document.getElementsByClassName('client_var_email'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_email'), function(el) {
@ -90,7 +93,7 @@ if (window.location.href.indexOf('/client') >= 0) {
el.innerText = ':' + getCookie('port'); el.innerText = ':' + getCookie('port');
}); });
} }
/* Hide those sections that are not applicable because useOutlookForEAS is disabled or SOGo integrator is not available */ /* Hide those sections that are not applicable because useOutlookForEAS is disabled or SOGo integrator is not available */
if (getCookie('integrator')) { if (getCookie('integrator')) {
Array.prototype.forEach.call(document.getElementsByClassName('client_var_integrator_link'), function(el) { Array.prototype.forEach.call(document.getElementsByClassName('client_var_integrator_link'), function(el) {