Replace security warning modal with inline banner in Preferences section
Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/e7946288-08c7-4081-85dd-6780f1eba17a Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
11ec4b4816
commit
1d4f104524
@@ -38,9 +38,6 @@ if ($upgradeCloseBtn) $upgradeCloseBtn.addEventListener("click", closeUpgradeMod
|
||||
if ($upgradeCancelBtn) $upgradeCancelBtn.addEventListener("click", closeUpgradeModal);
|
||||
if ($upgradeModal) $upgradeModal.addEventListener("click", function(e) { if (e.target === $upgradeModal) closeUpgradeModal(); });
|
||||
|
||||
// Legacy security warning modal — dismiss closes the modal only
|
||||
if ($securityWarningDismiss) $securityWarningDismiss.addEventListener("click", closeSecurityWarningModal);
|
||||
|
||||
// ── Upgrade modal functions ───────────────────────────────────────
|
||||
|
||||
function openUpgradeModal() {
|
||||
|
||||
@@ -599,9 +599,21 @@ function renderAutolaunchToggle(enabled) {
|
||||
var section = document.createElement("div");
|
||||
section.className = "category-section autolaunch-section";
|
||||
|
||||
var securityBanner = "";
|
||||
if (_securityIsLegacy) {
|
||||
var msg = _securityWarningMessage || "Your system may have factory default passwords. Please change your passwords to secure your system.";
|
||||
securityBanner =
|
||||
'<div class="security-inline-banner">' +
|
||||
'<span class="security-inline-icon">⚠</span>' +
|
||||
'<span class="security-inline-text">' + msg + '</span>' +
|
||||
'<a class="security-inline-link" href="/onboarding?step=passwords">Change Passwords</a>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
section.innerHTML =
|
||||
'<div class="section-header">Preferences</div>' +
|
||||
'<hr class="section-divider" />' +
|
||||
securityBanner +
|
||||
'<div class="feature-card">' +
|
||||
'<div class="feature-card-top">' +
|
||||
'<div class="feature-card-info">' +
|
||||
|
||||
@@ -2,20 +2,12 @@
|
||||
|
||||
// ── Legacy security warning ───────────────────────────────────────
|
||||
|
||||
function openSecurityWarningModal(message) {
|
||||
if ($securityWarningMessage) $securityWarningMessage.textContent = message;
|
||||
if ($securityWarningModal) $securityWarningModal.classList.add("open");
|
||||
}
|
||||
|
||||
function closeSecurityWarningModal() {
|
||||
if ($securityWarningModal) $securityWarningModal.classList.remove("open");
|
||||
}
|
||||
|
||||
async function checkLegacySecurity() {
|
||||
try {
|
||||
var data = await apiFetch("/api/security/status");
|
||||
if (data && data.status === "legacy") {
|
||||
openSecurityWarningModal(data.warning || "This machine may have a known factory password. Please change your passwords immediately.");
|
||||
_securityIsLegacy = true;
|
||||
_securityWarningMessage = data.warning || "This machine may have a known factory password. Please change your passwords immediately.";
|
||||
}
|
||||
} catch (_) {
|
||||
// Non-fatal — silently ignore if the endpoint is unreachable
|
||||
|
||||
@@ -99,10 +99,9 @@ const $upgradeConfirmBtn = document.getElementById("upgrade-confirm-btn");
|
||||
const $upgradeCancelBtn = document.getElementById("upgrade-cancel-btn");
|
||||
const $upgradeCloseBtn = document.getElementById("upgrade-close-btn");
|
||||
|
||||
// Legacy security warning modal
|
||||
const $securityWarningModal = document.getElementById("security-warning-modal");
|
||||
const $securityWarningMessage = document.getElementById("security-warning-message");
|
||||
const $securityWarningDismiss = document.getElementById("security-warning-dismiss-btn");
|
||||
// Legacy security warning state (populated by checkLegacySecurity in security.js)
|
||||
var _securityIsLegacy = false;
|
||||
var _securityWarningMessage = "";
|
||||
|
||||
// System status banner
|
||||
// (removed — health is now shown per-tile via the composite health field)
|
||||
Reference in New Issue
Block a user