| 148 | } |
| 149 | |
| 150 | function showRecoveryCodeModal(recoveryCode) { |
| 151 | const recoveryModal = document.createElement("div"); |
| 152 | recoveryModal.id = "recoveryModal"; |
| 153 | recoveryModal.style.cssText = ` |
| 154 | position: fixed; |
| 155 | top: 0; left: 0; |
| 156 | width: 100vw; height: 100vh; |
| 157 | background-color: rgba(0,0,0,0.3); |
| 158 | display: flex; justify-content: center; align-items: center; |
| 159 | z-index: 3200; |
| 160 | `; |
| 161 | recoveryModal.innerHTML = ` |
| 162 | <div style="background:#fff; color:#000; padding:20px; max-width:400px; width:90%; border-radius:8px; text-align:center;"> |
| 163 | <h3>${t("your_recovery_code")}</h3> |
| 164 | <p>${t("please_save_recovery_code")}</p> |
| 165 | <code style="display:block; margin:10px 0; font-size:20px;">${recoveryCode}</code> |
| 166 | <button type="button" id="closeRecoveryModal" class="btn btn-primary">${t("ok")}</button> |
| 167 | </div> |
| 168 | `; |
| 169 | document.body.appendChild(recoveryModal); |
| 170 | document.getElementById("closeRecoveryModal").addEventListener("click", () => { |
| 171 | recoveryModal.remove(); |
| 172 | }); |
| 173 | } |
| 174 | |
| 175 | export function openTOTPModal() { |
| 176 | let totpModal = document.getElementById("totpModal"); |