()
| 12851 | `; |
| 12852 | |
| 12853 | // Store codes temporarily for copy function |
| 12854 | window._tempRecoveryCodes = result.recovery_codes; |
| 12855 | |
| 12856 | addConsoleMessage('Authentication enabled - database encrypted', 'success'); |
| 12857 | } else { |
| 12858 | statusEl.className = 'p-3 rounded-lg text-sm bg-red-900/30 border border-red-700 text-red-300'; |
| 12859 | statusEl.textContent = result.error || 'Setup failed'; |
| 12860 | statusEl.classList.remove('hidden'); |
| 12861 | btn.disabled = false; |
| 12862 | btn.textContent = 'Enable Authentication'; |
| 12863 | } |
| 12864 | } catch (error) { |
| 12865 | statusEl.className = 'p-3 rounded-lg text-sm bg-red-900/30 border border-red-700 text-red-300'; |
| 12866 | statusEl.textContent = 'Setup failed: ' + (error.message || 'Unknown error'); |
| 12867 | statusEl.classList.remove('hidden'); |
| 12868 | btn.disabled = false; |
| 12869 | btn.textContent = 'Enable Authentication'; |
| 12870 | } |
| 12871 | } |
| 12872 | |
| 12873 | function copyRecoveryCodes() { |
| 12874 | if (window._tempRecoveryCodes) { |
| 12875 | const text = window._tempRecoveryCodes.join('\n'); |
| 12876 | navigator.clipboard.writeText(text).then(() => { |
| 12877 | const btn = document.getElementById('copy-codes-btn'); |
| 12878 | btn.textContent = 'Copied!'; |
| 12879 | setTimeout(() => { btn.textContent = 'Copy All Codes'; }, 2000); |
| 12880 | }).catch(() => { |
| 12881 | addConsoleMessage('Failed to copy - please select and copy manually', 'warning'); |
| 12882 | }); |
| 12883 | } |
| 12884 | } |
| 12885 | |
| 12886 | async function handleChangePassword(event) { |
| 12887 | event.preventDefault(); |
| 12888 | const statusEl = document.getElementById('change-pw-status'); |
| 12889 | |
| 12890 | const currentPw = document.getElementById('current-password').value; |
| 12891 | const newPw = document.getElementById('new-password').value; |
| 12892 | const confirmPw = document.getElementById('confirm-new-password').value; |
| 12893 | |
| 12894 | if (newPw !== confirmPw) { |
| 12895 | statusEl.className = 'p-3 rounded-lg text-sm bg-red-900/30 border border-red-700 text-red-300'; |
| 12896 | statusEl.textContent = 'New passwords do not match'; |
| 12897 | statusEl.classList.remove('hidden'); |
| 12898 | return; |
| 12899 | } |
| 12900 | |
| 12901 | try { |
nothing calls this directly
no test coverage detected