Marthee commited on
Commit
1cb3976
·
verified ·
1 Parent(s): 4eaba0c

Update templates/gui2.html

Browse files
Files changed (1) hide show
  1. templates/gui2.html +63 -62
templates/gui2.html CHANGED
@@ -1,62 +1,63 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Password Modal</title>
7
- <link rel="stylesheet" href="static/popups.css">
8
- </head>
9
- <body>
10
-
11
- <!-- Popup Modal HTML Structure -->
12
- <div id="mpopupBoxpassword" class="mpopuppassword">
13
- <!-- Modal content -->
14
- <div class="modal-contentpassword">
15
- <div class="modal-bodypassword" id="modal-bodyTextpassword">
16
- <p id='enterPText'>Enter Password to access ADR Console.</p>
17
- <input type="password" id="passwordField" placeholder="Enter Password" style="display: block; margin: 10px 0;">
18
- <button id="submitBtn">Submit</button>
19
- </div>
20
- </div>
21
- </div>
22
-
23
- <div id="errorMessage" class="error-message" style="display: none;">Error Validating. Please Refresh and Try Again.</div>
24
-
25
-
26
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
27
- <script>
28
- // Show the modal on page load
29
- document.getElementById('mpopupBoxpassword').style.display = "flex";
30
-
31
- // Event listener for the submit button
32
- document.getElementById('submitBtn').onclick = function() {
33
- validatePassword();
34
- };
35
-
36
- function validatePassword() {
37
- var enteredPassword = document.getElementById("passwordField").value;
38
-
39
- // Send the entered password to the Flask backend for validation
40
- $.ajax({
41
- url: '/check_password', // Flask route for password validation
42
- type: 'POST',
43
- data: { password: enteredPassword }, // Send entered password as form data
44
- success: function(response) {
45
- if (response.authenticated) {
46
- console.log('Correct Password');
47
- document.getElementById('mpopupBoxpassword').style.display = "none"; // Hide modal on success
48
- window.location.href = "/mainGUI"; // Redirect to the main GUI page
49
- } else {
50
- document.getElementById("passwordField").style.boxShadow = '0 0 8px 2px rgb(255, 0, 0)';
51
- }
52
- },
53
- error: function(jqXHR, textStatus, errorThrown) {
54
- // Show error message if validation fails
55
- document.getElementById('errorMessage').style.display = "block"; // Show error message
56
- }
57
- });
58
- }
59
- </script>
60
-
61
- </body>
62
- </html>
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Password Modal</title>
7
+ <link rel="stylesheet" href="static/popups.css">
8
+ </head>
9
+ <body>
10
+
11
+ <!-- Popup Modal HTML Structure -->
12
+ <div id="mpopupBoxpassword" class="mpopuppassword">
13
+ <!-- Modal content -->
14
+ <div class="modal-contentpassword">
15
+ <div class="modal-bodypassword" id="modal-bodyTextpassword">
16
+ <p id='enterPText'>Enter Password to access ADR Console.</p>
17
+ <input type="password" id="passwordField" placeholder="Enter Password" style="display: block; margin: 10px 0;">
18
+ <button id="submitBtn">Submit</button>
19
+ </div>
20
+ </div>
21
+ </div>
22
+
23
+ <div id="errorMessage" class="error-message" style="display: none;">Error Validating. Please Refresh and Try Again.</div>
24
+
25
+
26
+ <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
27
+ <script>
28
+ // Show the modal on page load
29
+ document.getElementById('mpopupBoxpassword').style.display = "flex";
30
+
31
+ // Event listener for the submit button
32
+ document.getElementById('submitBtn').onclick = function() {
33
+ validatePassword();
34
+ };
35
+
36
+ function validatePassword() {
37
+ var enteredPassword = document.getElementById("passwordField").value;
38
+
39
+ // Send the entered password to the Flask backend for validation
40
+ $.ajax({
41
+ url: '/check_password', // Flask route for password validation
42
+ type: 'POST',
43
+ data: {
44
+ password: enteredPassword // Send entered password as form data
45
+ },
46
+ success: function(response) {
47
+ if (response.authenticated) {
48
+ console.log('Correct Password');
49
+ document.getElementById('mpopupBoxpassword').style.display = "none"; // Hide modal on success
50
+ window.location.href = "/mainGUI"; // Redirect to the main GUI page
51
+ } else {
52
+ document.getElementById("passwordField").style.boxShadow = '0 0 8px 2px rgb(255, 0, 0)';
53
+ }
54
+ },
55
+ error: function(jqXHR, textStatus, errorThrown) {
56
+ // Show error message if validation fails
57
+ document.getElementById('errorMessage').style.display = "block"; // Show error message
58
+ }
59
+ });
60
+ }
61
+ </script>
62
+ </body>
63
+ </html>