Abddeus commited on
Commit
01b66ce
Β·
verified Β·
1 Parent(s): 26c8cf2

Update index.html

Browse files
Files changed (1) hide show
  1. 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
- <!-- Client-side Passcode Protection Gate -->
14
- <div id="security-gate" style="display:none;">
15
- <div class="gate-card">
16
- <div class="gate-icon">πŸ”’</div>
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
- <!-- Password Management & Share Modal -->
26
- <div id="pass-settings-modal" style="position:fixed; inset:0; z-index:9998; background:rgba(3,7,18,0.85); backdrop-filter:blur(8px); display:none; align-items:center; justify-content:center;">
27
- <div class="gate-card" style="width: 380px; text-align: left;">
28
- <div style="display:flex; justify-content:space-between; align-items:center;">
29
- <span style="font-weight:700; color:#f8fafc; font-size:14px;">πŸ”‘ Practice Security & Sharing</span>
30
- <span id="close-pass-modal" style="cursor:pointer; color:#94a3b8; font-size:16px;">βœ•</span>
31
- </div>
32
- <div class="gate-desc">Configure the shared password required by colleagues to open this tool.</div>
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
- <!-- ... existing code ... -->
51
- // -------------------------------------------------------------
52
- // Passcode Protection Gate (Free Shared Security Workaround)
53
- // -------------------------------------------------------------
54
- // Default master password is: ortho2026 (SHA-256 hash below)
55
- // SHA-256 of "ortho2026"
56
- const DEFAULT_PRESET_HASH = "80f4f9f74a9561081e35fa8f237bfb1740669b35414f4e6503c15aa31671239c";
 
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
- if (urlKey && urlKey === masterHash) {
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", async () => {
106
  const val = gatePassInput.value.trim();
107
  if (!val) return;
108
- const h = await hashPass(val);
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
- // Password Management & Share Link Buttons
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 ... -->