1 parent
5b22add1f3
commit
2c98b8f925
38 files changed
+915
-87
No files matched your search
@@ -458,13 +458,35 @@ function showApp() {
|
||||
$("#app-view").classList.remove("hidden");
|
||||
}
|
||||
|
||||
function settingsTabAvailable(name) {
|
||||
if (name === "openpgp") return state.authPolicy.pgpEnabled !== false;
|
||||
if (name === "sieve") return state.authPolicy.sieveEnabled !== false;
|
||||
if (name === "diagnostics") return state.authPolicy.diagnosticsEnabled !== false;
|
||||
if (name === "about") return state.authPolicy.aboutEnabled !== false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function applyFeatureAvailability() {
|
||||
for (const [name, enabled] of [
|
||||
["sieve", state.authPolicy.sieveEnabled !== false],
|
||||
["diagnostics", state.authPolicy.diagnosticsEnabled !== false],
|
||||
["about", state.authPolicy.aboutEnabled !== false],
|
||||
]) {
|
||||
$(`.settings-tab[data-tab="${name}"]`)?.classList.toggle("hidden", !enabled);
|
||||
$(`.settings-panel[data-panel="${name}"]`)?.toggleAttribute("data-feature-disabled", !enabled);
|
||||
}
|
||||
$("#diagnostic-sieve-card")?.classList.toggle("hidden", state.authPolicy.sieveEnabled === false);
|
||||
$("#quick-filter-btn")?.classList.toggle("hidden", state.authPolicy.sieveEnabled === false);
|
||||
}
|
||||
|
||||
async function loadAuthPolicy() {
|
||||
try {
|
||||
state.authPolicy = await request("/auth/policy", { method: "GET" });
|
||||
} catch (_) {
|
||||
state.authPolicy = { rememberMeEnabled: true, rememberMeDays: 30, sessionTimeoutHours: 24, pgpEnabled: true };
|
||||
state.authPolicy = { rememberMeEnabled: true, rememberMeDays: 30, sessionTimeoutHours: 24, pgpEnabled: true, sieveEnabled: true, diagnosticsEnabled: true, aboutEnabled: true };
|
||||
}
|
||||
setOpenPgpAvailability(state.authPolicy.pgpEnabled !== false);
|
||||
applyFeatureAvailability();
|
||||
const enabled = state.authPolicy.rememberMeEnabled !== false;
|
||||
["#login-remember-row", "#add-account-remember-row"].forEach((selector) => $(selector)?.classList.toggle("hidden", !enabled));
|
||||
["#login-remember", "#add-account-remember"].forEach((selector) => { const input = $(selector); if (input && !enabled) { input.checked = false; input.disabled = true; } });
|
||||
|
||||
Reference in new issue
Block a user