feat(status): TOTP recovery UI - panel, backup download, always-visible Import

- status/js/totp-recovery.js: NEW. Wires up recovery panel on the TOTP
  gate. Pastes Base32 -> /api/v1/totp/setup -> /verify-setup -> session.
  Exposes window._refreshRecoveryLink() called by totp-auth.js.
- status/js/totp-auth.js: showTotpOverlay() now calls
  _refreshRecoveryLink() so the recovery link hides when TOTP is healthy
  and appears when it's broken.
- status/js/totp-settings.js: removed setupSection.style.display='none'
  so 'Import existing secret' is always visible; added 'Download backup
  file' button after setup that exports the Base32 + recovery
  instructions as JSON.
- status/index.html: added 'Lost access? Recover with saved Base32
  key ->' link to the TOTP overlay plus the recovery panel itself;
  added title tooltip to the auth card reminding users to save the
  Base32 on first setup.
- status/build.js: include JS('totp-recovery.js') in the core bundle
  after totp-auth.js (since recovery registers a hook auth calls).
This commit is contained in:
Krystie
2026-06-18 19:56:52 -07:00
parent d230b39948
commit 3dff49cdc5
5 changed files with 313 additions and 5 deletions
+7
View File
@@ -21,6 +21,13 @@
const firstInput = overlay.querySelector('.totp-digits input');
if (firstInput) setTimeout(() => firstInput.focus(), 100);
}
// Refresh the "Lost access?" recovery link visibility based on server state.
// Hides itself if TOTP is healthy; shows if unreadable/corrupt. The user
// can still click it even when healthy — but the panel will explain there's
// no recovery needed. Cheaper than gating it.
if (typeof window._refreshRecoveryLink === 'function') {
window._refreshRecoveryLink();
}
}
function hideTotpOverlay() {