fixing ui
Deploy / deploy (push) Successful in 31s

This commit is contained in:
2026-05-06 09:37:48 +02:00
parent 5deb0e1056
commit ef8c864f2b
+23
View File
@@ -21,6 +21,14 @@ if (!isset($_SESSION["logged_in"]) || $_SESSION["logged_in"] !== true) {
?>
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <!-- Google Material Icons -->
<style>
.modal.modal-front {
z-index: 1065;
}
.modal-backdrop.modal-front-backdrop {
z-index: 1060;
}
</style>
</head>
<body>
<!-- Main Container -->
@@ -375,10 +383,12 @@ if (!isset($_SESSION["logged_in"]) || $_SESSION["logged_in"] !== true) {
}
} else {
// Handle error
switchElement.checked = false;
showErrorModal('Error: ' + (result.message || 'An error occurred while updating 2FA.'));
}
} catch (error) {
console.error('Error:', error);
switchElement.checked = false;
showErrorModal('Failed to send request. Please try again later.');
}
});
@@ -425,8 +435,20 @@ if (!isset($_SESSION["logged_in"]) || $_SESSION["logged_in"] !== true) {
// Function to show error modal
function showErrorModal(message) {
document.getElementById('errorModalMessage').textContent = message;
const errorElement = document.getElementById('errorModal');
const twofaIsOpen = document.getElementById('twofaModal').classList.contains('show');
errorElement.classList.toggle('modal-front', twofaIsOpen);
const errorModal = new bootstrap.Modal(document.getElementById('errorModal'));
errorModal.show();
if (twofaIsOpen) {
setTimeout(() => {
const backdrops = document.querySelectorAll('.modal-backdrop');
const latestBackdrop = backdrops[backdrops.length - 1];
if (latestBackdrop) {
latestBackdrop.classList.add('modal-front-backdrop');
}
}, 0);
}
}
function showSuccessModal(message) {
document.getElementById('successModalMessage').textContent = message;
@@ -466,6 +488,7 @@ if (!isset($_SESSION["logged_in"]) || $_SESSION["logged_in"] !== true) {
document.getElementById('2fa-switch').checked = true;
showSuccessModal(result.message || '2FA enabled successfully.');
} else {
document.getElementById('2fa-switch').checked = false;
showErrorModal(result.message || 'Invalid 2FA code.');
}
}