Enable custom css on login pages until a user with it disabled logs in.

This commit is contained in:
Ian Walton 2021-04-24 15:49:49 -04:00
parent b8f8633ffd
commit 99c902a1a1

View File

@ -217,9 +217,13 @@ function onAppReady() {
}
}
currentSettings.userIsSet().then(() => {
let cssHasLoadedTrigger;
const cssHasLoadedPromise = new Promise(resolve => {
cssHasLoadedTrigger = resolve;
});
const apiClient = ServerConnections.currentApiClient();
if (apiClient && !currentSettings.disableCustomCss()) {
if (apiClient) {
fetch(apiClient.getUrl('Branding/Css'))
.then(function(response) {
if (!response.ok) {
@ -237,12 +241,20 @@ function onAppReady() {
document.body.appendChild(style);
}
style.textContent = css;
cssHasLoadedTrigger(style);
})
.catch(function(err) {
console.warn('Error applying custom css', err);
});
}
currentSettings.userIsSet().then(() => {
if (currentSettings.disableCustomCss()) {
cssHasLoadedPromise.then(style => {
style.textContent = '';
});
}
const localCss = currentSettings.customCss();
if (localCss) {
let style = document.querySelector('#localCssBranding');