|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Password Modal</title>
|
|
|
<link rel="stylesheet" href="static/popups.css">
|
|
|
</head>
|
|
|
<body>
|
|
|
|
|
|
|
|
|
<div id="mpopupBoxpassword" class="mpopuppassword">
|
|
|
|
|
|
<div class="modal-contentpassword">
|
|
|
<div class="modal-bodypassword" id="modal-bodyTextpassword">
|
|
|
<p id='enterPText'>Enter Password to access ADR Console.</p>
|
|
|
<input type="password" id="passwordField" placeholder="Enter Password" style="display: block; margin: 10px 0;">
|
|
|
<button id="submitBtn">Submit</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div id="errorMessage" class="error-message" style="display: none;">Error Validating. Please Refresh and Try Again.</div>
|
|
|
|
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
<script>
|
|
|
|
|
|
document.getElementById('mpopupBoxpassword').style.display = "flex";
|
|
|
|
|
|
|
|
|
document.getElementById('submitBtn').onclick = function() {
|
|
|
validatePassword();
|
|
|
};
|
|
|
|
|
|
function validatePassword() {
|
|
|
var enteredPassword = document.getElementById("passwordField").value;
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/check_password',
|
|
|
type: 'POST',
|
|
|
data: {
|
|
|
password: enteredPassword
|
|
|
},
|
|
|
success: function(response) {
|
|
|
if (response.authenticated) {
|
|
|
console.log('Correct Password');
|
|
|
document.getElementById('mpopupBoxpassword').style.display = "none";
|
|
|
window.location.href = "/mainGUI";
|
|
|
} else {
|
|
|
document.getElementById("passwordField").style.boxShadow = '0 0 8px 2px rgb(255, 0, 0)';
|
|
|
}
|
|
|
},
|
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
|
|
|
|
document.getElementById('errorMessage').style.display = "block";
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|
|
|
|