Merge pull request #117 from naturallaw777/copilot/remove-security-warning-modal
[WIP] Remove legacy password warning modal and add inline message
This commit is contained in:
@@ -1,55 +1,42 @@
|
|||||||
/* ── Legacy security warning modal ──────────────────────────────── */
|
/* ── Legacy security inline warning banner ───────────────────────── */
|
||||||
|
|
||||||
.security-warning-dialog {
|
.security-inline-banner {
|
||||||
max-width: 520px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.security-warning-header {
|
|
||||||
background-color: #3b1212;
|
|
||||||
border-bottom-color: #7a2020;
|
|
||||||
}
|
|
||||||
|
|
||||||
.security-warning-body {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
gap: 10px;
|
||||||
gap: 16px;
|
padding: 12px 14px;
|
||||||
padding: 24px 20px;
|
margin-bottom: 12px;
|
||||||
}
|
background-color: rgba(180, 100, 0, 0.12);
|
||||||
|
border-left: 3px solid #c97a00;
|
||||||
.security-warning-icon {
|
border-radius: 6px;
|
||||||
font-size: 2.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.security-warning-message {
|
|
||||||
text-align: center;
|
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
line-height: 1.6;
|
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.security-warning-actions {
|
.security-inline-icon {
|
||||||
width: 100%;
|
font-size: 1rem;
|
||||||
display: flex;
|
color: #e69000;
|
||||||
flex-direction: column;
|
flex-shrink: 0;
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.security-warning-hint {
|
.security-inline-text {
|
||||||
|
font-size: 0.82rem;
|
||||||
|
line-height: 1.5;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 0.85rem;
|
|
||||||
margin: 0;
|
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.security-warning-links {
|
.security-inline-link {
|
||||||
display: flex;
|
display: inline-block;
|
||||||
gap: 12px;
|
font-size: 0.82rem;
|
||||||
flex-wrap: wrap;
|
font-weight: 600;
|
||||||
justify-content: center;
|
color: #e69000;
|
||||||
}
|
|
||||||
|
|
||||||
.security-warning-link {
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
border: 1px solid #c97a00;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
align-self: flex-start;
|
||||||
|
transition: background-color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.security-inline-link:hover {
|
||||||
|
background-color: rgba(180, 100, 0, 0.22);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ if ($upgradeCloseBtn) $upgradeCloseBtn.addEventListener("click", closeUpgradeMod
|
|||||||
if ($upgradeCancelBtn) $upgradeCancelBtn.addEventListener("click", closeUpgradeModal);
|
if ($upgradeCancelBtn) $upgradeCancelBtn.addEventListener("click", closeUpgradeModal);
|
||||||
if ($upgradeModal) $upgradeModal.addEventListener("click", function(e) { if (e.target === $upgradeModal) 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 ───────────────────────────────────────
|
// ── Upgrade modal functions ───────────────────────────────────────
|
||||||
|
|
||||||
function openUpgradeModal() {
|
function openUpgradeModal() {
|
||||||
|
|||||||
@@ -599,9 +599,21 @@ function renderAutolaunchToggle(enabled) {
|
|||||||
var section = document.createElement("div");
|
var section = document.createElement("div");
|
||||||
section.className = "category-section autolaunch-section";
|
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 =
|
section.innerHTML =
|
||||||
'<div class="section-header">Preferences</div>' +
|
'<div class="section-header">Preferences</div>' +
|
||||||
'<hr class="section-divider" />' +
|
'<hr class="section-divider" />' +
|
||||||
|
securityBanner +
|
||||||
'<div class="feature-card">' +
|
'<div class="feature-card">' +
|
||||||
'<div class="feature-card-top">' +
|
'<div class="feature-card-top">' +
|
||||||
'<div class="feature-card-info">' +
|
'<div class="feature-card-info">' +
|
||||||
|
|||||||
@@ -2,20 +2,12 @@
|
|||||||
|
|
||||||
// ── Legacy security warning ───────────────────────────────────────
|
// ── 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() {
|
async function checkLegacySecurity() {
|
||||||
try {
|
try {
|
||||||
var data = await apiFetch("/api/security/status");
|
var data = await apiFetch("/api/security/status");
|
||||||
if (data && data.status === "legacy") {
|
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 (_) {
|
} catch (_) {
|
||||||
// Non-fatal — silently ignore if the endpoint is unreachable
|
// 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 $upgradeCancelBtn = document.getElementById("upgrade-cancel-btn");
|
||||||
const $upgradeCloseBtn = document.getElementById("upgrade-close-btn");
|
const $upgradeCloseBtn = document.getElementById("upgrade-close-btn");
|
||||||
|
|
||||||
// Legacy security warning modal
|
// Legacy security warning state (populated by checkLegacySecurity in security.js)
|
||||||
const $securityWarningModal = document.getElementById("security-warning-modal");
|
var _securityIsLegacy = false;
|
||||||
const $securityWarningMessage = document.getElementById("security-warning-message");
|
var _securityWarningMessage = "";
|
||||||
const $securityWarningDismiss = document.getElementById("security-warning-dismiss-btn");
|
|
||||||
|
|
||||||
// System status banner
|
// System status banner
|
||||||
// (removed — health is now shown per-tile via the composite health field)
|
// (removed — health is now shown per-tile via the composite health field)
|
||||||
@@ -210,26 +210,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Legacy Security Warning Modal -->
|
|
||||||
<div class="modal-overlay" id="security-warning-modal" role="alertdialog" aria-modal="true" aria-labelledby="security-warning-title">
|
|
||||||
<div class="creds-dialog security-warning-dialog">
|
|
||||||
<div class="creds-header security-warning-header">
|
|
||||||
<span class="creds-title" id="security-warning-title">⚠️ Security Warning</span>
|
|
||||||
</div>
|
|
||||||
<div class="creds-body security-warning-body">
|
|
||||||
<div class="security-warning-icon">🔒</div>
|
|
||||||
<p class="security-warning-message" id="security-warning-message"></p>
|
|
||||||
<div class="security-warning-actions">
|
|
||||||
<p class="security-warning-hint">Change your passwords now to secure your system:</p>
|
|
||||||
<div class="security-warning-links">
|
|
||||||
<a class="btn btn-primary security-warning-link" href="/onboarding?step=passwords" id="security-warning-change-btn">Change Passwords</a>
|
|
||||||
<button class="btn btn-close-modal" id="security-warning-dismiss-btn">I Understand — Dismiss</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Reboot overlay -->
|
<!-- Reboot overlay -->
|
||||||
<div class="reboot-overlay" id="reboot-overlay">
|
<div class="reboot-overlay" id="reboot-overlay">
|
||||||
<div class="reboot-card">
|
<div class="reboot-card">
|
||||||
|
|||||||
Reference in New Issue
Block a user