Update index.html
Browse files- index.html +30 -120
index.html
CHANGED
|
@@ -2,113 +2,62 @@
|
|
| 2 |
<button class="btn btn-secondary" onclick="window.print()" title="Print full ABO Ceph Report">
|
| 3 |
π¨οΈ Print
|
| 4 |
</button>
|
| 5 |
-
<button class="btn btn-secondary" id="btn-share-pass" title="Change or share practice password">
|
| 6 |
-
π Password
|
| 7 |
-
</button>
|
| 8 |
<button class="btn btn-secondary" id="btn-lock-suite" title="Lock application with password">
|
| 9 |
π Lock
|
| 10 |
</button>
|
| 11 |
<button class="btn btn-danger" id="btn-next-patient" title="Clear current patient">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
<!-- ... existing code ... -->
|
| 13 |
-
<
|
| 14 |
-
<div id="
|
| 15 |
-
|
| 16 |
-
<
|
| 17 |
-
<div class="gate-title" id="gate-title">Clinical Suite Locked</div>
|
| 18 |
-
<div class="gate-desc" id="gate-desc">Enter practice password to access patient cephalograms and analysis.</div>
|
| 19 |
-
<input type="password" id="gate-pass" class="input-field" placeholder="Enter Password" style="text-align: center; font-size: 14px; letter-spacing: 2px;">
|
| 20 |
-
<button class="btn" id="btn-unlock-gate" style="padding: 8px;">π Unlock Suite</button>
|
| 21 |
-
<div id="gate-err" style="color: #f43f5e; font-size: 10px; font-weight: 600; display: none;">Incorrect password. Try again.</div>
|
| 22 |
</div>
|
| 23 |
</div>
|
| 24 |
|
| 25 |
-
<!--
|
| 26 |
-
<div id="
|
| 27 |
-
<div class="gate-card" style="width:
|
| 28 |
-
<div style="
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
<
|
| 32 |
-
<
|
| 33 |
-
|
| 34 |
-
<div class="form-group">
|
| 35 |
-
<label>New Practice Password</label>
|
| 36 |
-
<input type="text" id="new-practice-pass" class="input-field" placeholder="e.g. clinic2026">
|
| 37 |
-
</div>
|
| 38 |
-
|
| 39 |
-
<button class="btn" id="btn-save-new-pass" style="padding:7px;">Update Master Password</button>
|
| 40 |
-
|
| 41 |
-
<div style="border-top: 1px solid #334155; padding-top: 10px; margin-top: 4px;">
|
| 42 |
-
<div style="font-size:10px; font-weight:700; color:#94a3b8; text-transform:uppercase; margin-bottom:4px;">1-Click Colleague Invite Link</div>
|
| 43 |
-
<div style="font-size:10px; color:#64748b; margin-bottom:6px;">Generates a protected URL that allows trusted doctors to open without entering the password manually:</div>
|
| 44 |
-
<button class="btn btn-secondary" id="btn-copy-share-link" style="width:100%; font-size:10.5px;">π Copy 1-Click Secure Link</button>
|
| 45 |
-
</div>
|
| 46 |
</div>
|
| 47 |
</div>
|
| 48 |
|
| 49 |
<div id="toast-msg">Notification</div>
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
//
|
| 53 |
-
//
|
| 54 |
-
//
|
| 55 |
-
//
|
| 56 |
-
|
|
|
|
| 57 |
|
| 58 |
const gateElem = document.getElementById("security-gate");
|
| 59 |
const gatePassInput = document.getElementById("gate-pass");
|
| 60 |
const gateErr = document.getElementById("gate-err");
|
| 61 |
-
const gateTitle = document.getElementById("gate-title");
|
| 62 |
-
const gateDesc = document.getElementById("gate-desc");
|
| 63 |
-
const passModal = document.getElementById("pass-settings-modal");
|
| 64 |
-
|
| 65 |
-
async function hashPass(str) {
|
| 66 |
-
const enc = new TextEncoder().encode(str);
|
| 67 |
-
const hash = await crypto.subtle.digest("SHA-256", enc);
|
| 68 |
-
return Array.from(new Uint8Array(hash)).map(b => b.toString(16).padStart(2, '0')).join('');
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
function getActiveMasterHash() {
|
| 72 |
-
return localStorage.getItem("orthoceph_pass_hash") || DEFAULT_PRESET_HASH;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
async function checkOrPromptSecurity() {
|
| 76 |
-
// Check if link contains a pre-authorized access token (?key=...)
|
| 77 |
-
const urlParams = new URLSearchParams(window.location.search);
|
| 78 |
-
const urlKey = urlParams.get("key");
|
| 79 |
-
const masterHash = getActiveMasterHash();
|
| 80 |
|
| 81 |
-
|
| 82 |
-
// Authorized via share link
|
| 83 |
-
sessionStorage.setItem("orthoceph_unlocked", "1");
|
| 84 |
-
// Clean up query param from URL bar without reload
|
| 85 |
-
window.history.replaceState({}, document.title, window.location.pathname);
|
| 86 |
-
notify("Authorized via secure invite link.");
|
| 87 |
-
return;
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
// Check if already unlocked in this browser tab
|
| 91 |
if (sessionStorage.getItem("orthoceph_unlocked") === "1") {
|
| 92 |
gateElem.style.display = "none";
|
| 93 |
return;
|
| 94 |
}
|
| 95 |
-
|
| 96 |
-
// Always show lock screen by default
|
| 97 |
-
gateTitle.innerText = "Clinical Suite Locked";
|
| 98 |
-
gateDesc.innerText = "Enter practice password to access records.";
|
| 99 |
-
document.getElementById("btn-unlock-gate").innerText = "π Unlock Suite";
|
| 100 |
gateElem.style.display = "flex";
|
| 101 |
gatePassInput.value = "";
|
| 102 |
gateErr.style.display = "none";
|
| 103 |
}
|
| 104 |
|
| 105 |
-
document.getElementById("btn-unlock-gate").addEventListener("click",
|
| 106 |
const val = gatePassInput.value.trim();
|
| 107 |
if (!val) return;
|
| 108 |
-
|
| 109 |
-
const masterHash = getActiveMasterHash();
|
| 110 |
-
|
| 111 |
-
if (h === masterHash) {
|
| 112 |
sessionStorage.setItem("orthoceph_unlocked", "1");
|
| 113 |
gateElem.style.display = "none";
|
| 114 |
gatePassInput.value = "";
|
|
@@ -133,48 +82,9 @@ document.getElementById("btn-lock-suite").addEventListener("click", () => {
|
|
| 133 |
gatePassInput.focus();
|
| 134 |
});
|
| 135 |
|
| 136 |
-
//
|
| 137 |
-
document.getElementById("btn-share-pass").addEventListener("click", () => {
|
| 138 |
-
passModal.style.display = "flex";
|
| 139 |
-
document.getElementById("new-practice-pass").value = "";
|
| 140 |
-
});
|
| 141 |
-
|
| 142 |
-
document.getElementById("close-pass-modal").addEventListener("click", () => {
|
| 143 |
-
passModal.style.display = "none";
|
| 144 |
-
});
|
| 145 |
-
|
| 146 |
-
document.getElementById("btn-save-new-pass").addEventListener("click", async () => {
|
| 147 |
-
const p = document.getElementById("new-practice-pass").value.trim();
|
| 148 |
-
if (!p) {
|
| 149 |
-
notify("Please enter a valid password.");
|
| 150 |
-
return;
|
| 151 |
-
}
|
| 152 |
-
const h = await hashPass(p);
|
| 153 |
-
localStorage.setItem("orthoceph_pass_hash", h);
|
| 154 |
-
notify(`Master password changed to "${p}". Remember to share this with colleagues!`, 4000);
|
| 155 |
-
passModal.style.display = "none";
|
| 156 |
-
});
|
| 157 |
-
|
| 158 |
-
document.getElementById("btn-copy-share-link").addEventListener("click", () => {
|
| 159 |
-
const masterHash = getActiveMasterHash();
|
| 160 |
-
const shareUrl = `${window.location.origin}${window.location.pathname}?key=${masterHash}`;
|
| 161 |
-
|
| 162 |
-
const ta = document.createElement("textarea");
|
| 163 |
-
ta.value = shareUrl;
|
| 164 |
-
document.body.appendChild(ta);
|
| 165 |
-
ta.select();
|
| 166 |
-
try {
|
| 167 |
-
document.execCommand("copy");
|
| 168 |
-
notify("1-Click Authorized Invite link copied to clipboard!");
|
| 169 |
-
} catch (err) {
|
| 170 |
-
notify("Copy failed, please copy URL manually.");
|
| 171 |
-
}
|
| 172 |
-
document.body.removeChild(ta);
|
| 173 |
-
passModal.style.display = "none";
|
| 174 |
-
});
|
| 175 |
-
|
| 176 |
-
// Run security check on load
|
| 177 |
checkOrPromptSecurity();
|
| 178 |
|
| 179 |
// Sync Demographics to Print Layout before print dialog opens
|
|
|
|
| 180 |
<!-- ... existing code ... -->
|
|
|
|
| 2 |
<button class="btn btn-secondary" onclick="window.print()" title="Print full ABO Ceph Report">
|
| 3 |
π¨οΈ Print
|
| 4 |
</button>
|
|
|
|
|
|
|
|
|
|
| 5 |
<button class="btn btn-secondary" id="btn-lock-suite" title="Lock application with password">
|
| 6 |
π Lock
|
| 7 |
</button>
|
| 8 |
<button class="btn btn-danger" id="btn-next-patient" title="Clear current patient">
|
| 9 |
+
π Next Patient
|
| 10 |
+
</button>
|
| 11 |
+
</div>
|
| 12 |
+
</header>
|
| 13 |
<!-- ... existing code ... -->
|
| 14 |
+
<div class="print-table-col" id="print-col-right">
|
| 15 |
+
<div id="print-abo-table"></div>
|
| 16 |
+
<div id="print-holdaway-table" style="margin-top: 10px;"></div>
|
| 17 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
</div>
|
| 19 |
</div>
|
| 20 |
|
| 21 |
+
<!-- Client-side Passcode Protection Gate -->
|
| 22 |
+
<div id="security-gate" style="position:fixed; inset:0; z-index:9999; background:rgba(3,7,18,0.95); backdrop-filter:blur(10px); display:none; align-items:center; justify-content:center;">
|
| 23 |
+
<div class="gate-card" style="background:#1e293b; border:1px solid #334155; border-radius:12px; padding:24px; width:320px; display:flex; flex-direction:column; gap:12px; text-align:center; box-shadow:0 20px 40px rgba(0,0,0,0.6);">
|
| 24 |
+
<div style="font-size:32px;">π</div>
|
| 25 |
+
<div style="font-size:15px; font-weight:700; color:#f8fafc;">Clinical Suite Locked</div>
|
| 26 |
+
<div style="font-size:11px; color:#94a3b8; line-height:1.4;">Enter practice password to access patient cephalograms and analysis.</div>
|
| 27 |
+
<input type="password" id="gate-pass" class="input-field" placeholder="Enter Password" style="text-align:center; font-size:14px; letter-spacing:2px; background:#0f172a; border:1px solid #334155; border-radius:6px; padding:8px; color:#fff;">
|
| 28 |
+
<button class="btn" id="btn-unlock-gate" style="padding:8px; background:#2563eb; color:#fff; border:none; border-radius:6px; font-weight:600; cursor:pointer;">π Unlock Suite</button>
|
| 29 |
+
<div id="gate-err" style="color:#f43f5e; font-size:11px; font-weight:600; display:none;">Incorrect password. Try again.</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
</div>
|
| 31 |
</div>
|
| 32 |
|
| 33 |
<div id="toast-msg">Notification</div>
|
| 34 |
+
|
| 35 |
+
<script>
|
| 36 |
+
// =============================================================
|
| 37 |
+
// CLINICAL SUITE ACCESS CONTROL
|
| 38 |
+
// Only YOU can change this password by editing the line below.
|
| 39 |
+
// Visitors/colleagues CANNOT change it (there is no change button).
|
| 40 |
+
// =============================================================
|
| 41 |
+
const MASTER_PASSWORD = "ortho2026"; // <-- Change your practice password here
|
| 42 |
|
| 43 |
const gateElem = document.getElementById("security-gate");
|
| 44 |
const gatePassInput = document.getElementById("gate-pass");
|
| 45 |
const gateErr = document.getElementById("gate-err");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
function checkOrPromptSecurity() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
if (sessionStorage.getItem("orthoceph_unlocked") === "1") {
|
| 49 |
gateElem.style.display = "none";
|
| 50 |
return;
|
| 51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
gateElem.style.display = "flex";
|
| 53 |
gatePassInput.value = "";
|
| 54 |
gateErr.style.display = "none";
|
| 55 |
}
|
| 56 |
|
| 57 |
+
document.getElementById("btn-unlock-gate").addEventListener("click", () => {
|
| 58 |
const val = gatePassInput.value.trim();
|
| 59 |
if (!val) return;
|
| 60 |
+
if (val === MASTER_PASSWORD) {
|
|
|
|
|
|
|
|
|
|
| 61 |
sessionStorage.setItem("orthoceph_unlocked", "1");
|
| 62 |
gateElem.style.display = "none";
|
| 63 |
gatePassInput.value = "";
|
|
|
|
| 82 |
gatePassInput.focus();
|
| 83 |
});
|
| 84 |
|
| 85 |
+
// Run security gate check immediately on load
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
checkOrPromptSecurity();
|
| 87 |
|
| 88 |
// Sync Demographics to Print Layout before print dialog opens
|
| 89 |
+
window.addEventListener("beforeprint", () => {
|
| 90 |
<!-- ... existing code ... -->
|