(disable = true)
| 277 | } |
| 278 | |
| 279 | export function closeTOTPModal(disable = true) { |
| 280 | const totpModal = document.getElementById("totpModal"); |
| 281 | if (totpModal) totpModal.style.display = "none"; |
| 282 | if (disable) { |
| 283 | const totpCheckbox = document.getElementById("userTOTPEnabled"); |
| 284 | if (totpCheckbox) { |
| 285 | totpCheckbox.checked = false; |
| 286 | localStorage.setItem("userTOTPEnabled", "false"); |
| 287 | } |
| 288 | fetch("/api/profile/totp_disable.php", { |
| 289 | method: "POST", |
| 290 | credentials: "include", |
| 291 | headers: { |
| 292 | "Content-Type": "application/json", |
| 293 | "X-CSRF-Token": window.csrfToken |
| 294 | } |
| 295 | }) |
| 296 | .then(r => r.json()) |
| 297 | .then(result => { |
| 298 | if (!result.success) showToast(t("error_disabling_totp_setting") + ": " + result.error); |
| 299 | }) |
| 300 | .catch(() => showToast(t("error_disabling_totp_setting"))); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | export function openApiModal() { |
| 305 | let apiModal = document.getElementById("apiModal"); |
no test coverage detected