KapilWaghumbare123 commited on
Commit
b216762
Β·
verified Β·
1 Parent(s): 8546a25

Update Web/password-checker.html

Browse files
Files changed (1) hide show
  1. Web/password-checker.html +49 -51
Web/password-checker.html CHANGED
@@ -38,38 +38,36 @@
38
  color: #ffffff;
39
  }
40
  .strength-wrapper {
41
- margin-top: 25px;
42
- width: 90%;
43
- margin-left: auto;
44
- margin-right: auto;
45
- }
46
-
47
-
48
- .strength-bar-bg {
49
- width: 100%;
50
- height: 14px;
51
- background: #ddd;
52
- border-radius: 10px;
53
- overflow: hidden;
54
- }
55
-
56
- .strength-bar {
57
- height: 100%;
58
- width: 0%;
59
- transition: width 0.3s ease;
60
- background: red;
61
- }
62
-
63
- .strength-label {
64
- margin-top: 8px;
65
- font-weight: 600;
66
- text-align: left;
67
- }
68
-
69
-
70
- header nav a:hover {
71
- color: #000;
72
- }
73
 
74
  .container {
75
  max-width: 750px;
@@ -134,7 +132,6 @@ header nav a:hover {
134
  line-height: 1.6;
135
  text-align: left;
136
  }
137
-
138
 
139
  footer {
140
  background: #202020;
@@ -183,21 +180,21 @@ header nav a:hover {
183
  <button onclick="checkPassword()">Check Password Strength</button>
184
  <div class="strength-wrapper">
185
  <div id="frozenNote" style="margin-top: 6px; font-size: 13px; color: #888; display: none;">
186
- Bar is frozen β€” click "Check Password Strength" to update.
187
- </div>
188
- <div class="strength-bar-bg">
189
- <div class="strength-bar" id="strengthBar"></div>
190
- </div>
191
- <div class="strength-label" id="strengthLabel">Strength: –</div>
192
- </div>
193
 
194
  <div class="result" id="resultText">Result: –</div>
195
 
196
  <div class="extra-info">
197
  Evaluates password resilience using a trained higher-order Markov model, computing bits-per-character entropy from real-world patterns and normalizing it into a precise 0–100 strength score reflecting resistance to modern cracking. </div>
198
- </div>
199
  </div>
200
- <footer>
 
201
  <div class="footer-content">
202
  <div class="footer-item">
203
  <img src="Sir.jpg" alt="user">
@@ -228,17 +225,19 @@ header nav a:hover {
228
  </div>
229
  </div>
230
 
231
- <div class="contact">
232
- Contact us: <a href="https://mail.google.com/mail/?view=cm&to=spectroguard.security@gmail.com&su=SpectroGuard%20Inquiry" target="_blank" style="color: #1877F2;">spectroguard.security@gmail.com</a>
233
- </div>
234
  </footer>
 
235
  <script>
236
  const bar = document.getElementById("strengthBar");
237
  const label = document.getElementById("strengthLabel");
238
  const result = document.getElementById("resultText");
239
  const input = document.getElementById("PassInput");
 
240
  input.addEventListener("keydown", (e) => {
241
- if (e.key === "Enter") checkPassword();
242
  });
243
 
244
  let frozen = false;
@@ -253,8 +252,6 @@ header nav a:hover {
253
  }
254
  });
255
 
256
- document.querySelector("button").addEventListener("click", checkPassword);
257
-
258
  async function checkPassword() {
259
  const password = input.value;
260
  if (!password) { resetUI(); return; }
@@ -265,7 +262,8 @@ header nav a:hover {
265
  label.style.color = "#888";
266
 
267
  try {
268
- const res = await fetch("http://127.0.0.1:5000/check_password", {
 
269
  method: "POST",
270
  headers: { "Content-Type": "application/json" },
271
  body: JSON.stringify({ password })
@@ -274,9 +272,9 @@ header nav a:hover {
274
  const data = await res.json();
275
  updateUI(data.score, data.label);
276
  lastCheckedValue = password;
277
- frozen = true; // ← freeze after successful check
278
  } catch {
279
- label.textContent = "⚠ Backend not running β€” start app.py";
280
  label.style.color = "#cc0000";
281
  bar.style.width = "0%";
282
  result.textContent = "Result: –";
 
38
  color: #ffffff;
39
  }
40
  .strength-wrapper {
41
+ margin-top: 25px;
42
+ width: 90%;
43
+ margin-left: auto;
44
+ margin-right: auto;
45
+ }
46
+
47
+ .strength-bar-bg {
48
+ width: 100%;
49
+ height: 14px;
50
+ background: #ddd;
51
+ border-radius: 10px;
52
+ overflow: hidden;
53
+ }
54
+
55
+ .strength-bar {
56
+ height: 100%;
57
+ width: 0%;
58
+ transition: width 0.3s ease;
59
+ background: red;
60
+ }
61
+
62
+ .strength-label {
63
+ margin-top: 8px;
64
+ font-weight: 600;
65
+ text-align: left;
66
+ }
67
+
68
+ header nav a:hover {
69
+ color: #000;
70
+ }
 
 
71
 
72
  .container {
73
  max-width: 750px;
 
132
  line-height: 1.6;
133
  text-align: left;
134
  }
 
135
 
136
  footer {
137
  background: #202020;
 
180
  <button onclick="checkPassword()">Check Password Strength</button>
181
  <div class="strength-wrapper">
182
  <div id="frozenNote" style="margin-top: 6px; font-size: 13px; color: #888; display: none;">
183
+ Bar is frozen β€” click "Check Password Strength" to update.
184
+ </div>
185
+ <div class="strength-bar-bg">
186
+ <div class="strength-bar" id="strengthBar"></div>
187
+ </div>
188
+ <div class="strength-label" id="strengthLabel">Strength: –</div>
189
+ </div>
190
 
191
  <div class="result" id="resultText">Result: –</div>
192
 
193
  <div class="extra-info">
194
  Evaluates password resilience using a trained higher-order Markov model, computing bits-per-character entropy from real-world patterns and normalizing it into a precise 0–100 strength score reflecting resistance to modern cracking. </div>
 
195
  </div>
196
+
197
+ <footer>
198
  <div class="footer-content">
199
  <div class="footer-item">
200
  <img src="Sir.jpg" alt="user">
 
225
  </div>
226
  </div>
227
 
228
+ <div class="contact">
229
+ Contact us: <a href="https://mail.google.com/mail/?view=cm&to=spectroguard.security@gmail.com&su=SpectroGuard%20Inquiry" target="_blank" style="color: #1877F2;">spectroguard.security@gmail.com</a>
230
+ </div>
231
  </footer>
232
+
233
  <script>
234
  const bar = document.getElementById("strengthBar");
235
  const label = document.getElementById("strengthLabel");
236
  const result = document.getElementById("resultText");
237
  const input = document.getElementById("PassInput");
238
+
239
  input.addEventListener("keydown", (e) => {
240
+ if (e.key === "Enter") checkPassword();
241
  });
242
 
243
  let frozen = false;
 
252
  }
253
  });
254
 
 
 
255
  async function checkPassword() {
256
  const password = input.value;
257
  if (!password) { resetUI(); return; }
 
262
  label.style.color = "#888";
263
 
264
  try {
265
+ // πŸ”— FIXED: Pointing relative endpoint path to the server container domain root
266
+ const res = await fetch("/check_password", {
267
  method: "POST",
268
  headers: { "Content-Type": "application/json" },
269
  body: JSON.stringify({ password })
 
272
  const data = await res.json();
273
  updateUI(data.score, data.label);
274
  lastCheckedValue = password;
275
+ frozen = true;
276
  } catch {
277
+ label.textContent = "⚠ Server Error β€” Connection could not be established";
278
  label.style.color = "#cc0000";
279
  bar.style.width = "0%";
280
  result.textContent = "Result: –";