@@ -483,12 +483,17 @@ if (!isset($_SESSION["logged_in"]) || $_SESSION["logged_in"] !== true) {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
const twofaSwitch = document.getElementById('twofa-switch');
|
||||||
if (response.ok && result.success) {
|
if (response.ok && result.success) {
|
||||||
bootstrap.Modal.getInstance(document.getElementById('twofaModal')).hide();
|
bootstrap.Modal.getInstance(document.getElementById('twofaModal')).hide();
|
||||||
document.getElementById('2fa-switch').checked = true;
|
if (twofaSwitch) {
|
||||||
|
twofaSwitch.checked = true;
|
||||||
|
}
|
||||||
showSuccessModal(result.message || '2FA enabled successfully.');
|
showSuccessModal(result.message || '2FA enabled successfully.');
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('2fa-switch').checked = false;
|
if (twofaSwitch) {
|
||||||
|
twofaSwitch.checked = false;
|
||||||
|
}
|
||||||
showErrorModal(result.message || 'Invalid 2FA code.');
|
showErrorModal(result.message || 'Invalid 2FA code.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user