()
| 257 | } |
| 258 | |
| 259 | function loadTOTPQRCode() { |
| 260 | fetch("/api/profile/totp_setup.php", { |
| 261 | method: "GET", |
| 262 | credentials: "include", |
| 263 | headers: { "X-CSRF-Token": window.csrfToken } |
| 264 | }) |
| 265 | .then(res => { |
| 266 | if (!res.ok) throw new Error("Failed to fetch QR code: " + res.status); |
| 267 | return res.blob(); |
| 268 | }) |
| 269 | .then(blob => { |
| 270 | const url = URL.createObjectURL(blob); |
| 271 | document.getElementById("totpQRCodeImage").src = url; |
| 272 | }) |
| 273 | .catch(err => { |
| 274 | console.error(err); |
| 275 | showToast(t("error_loading_qr_code")); |
| 276 | }); |
| 277 | } |
| 278 | |
| 279 | export function closeTOTPModal(disable = true) { |
| 280 | const totpModal = document.getElementById("totpModal"); |
no test coverage detected