MCPcopy Create free account
hub / github.com/error311/FileRise / closeTOTPModal

Function closeTOTPModal

public/js/authModals.js:279–302  ·  view source on GitHub ↗
(disable = true)

Source from the content-addressed store, hash-verified

277}
278
279export 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
304export function openApiModal() {
305 let apiModal = document.getElementById("apiModal");

Callers 1

openTOTPModalFunction · 0.85

Calls 2

tFunction · 0.85
showToastFunction · 0.70

Tested by

no test coverage detected