MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / saveConfig

Function saveConfig

web/scripts/ragnar_modern.js:12775–12821  ·  view source on GitHub ↗
(form)

Source from the content-addressed store, hash-verified

12773 <button onclick="handleRegenRecovery()"
12774 class="bg-yellow-600 hover:bg-yellow-700 text-white px-4 py-2 rounded-lg transition-colors text-sm">
12775 Regenerate Recovery Codes
12776 </button>
12777 </div>
12778
12779 <!-- Logout -->
12780 <div class="glass rounded-lg p-4">
12781 <h4 class="font-medium mb-3">Session</h4>
12782 <button onclick="handleLogout()"
12783 class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg transition-colors text-sm">
12784 Logout
12785 </button>
12786 </div>
12787 </div>
12788 `;
12789 }
12790 } catch (error) {
12791 console.error('Error loading security config:', error);
12792 }
12793}
12794
12795async function handleAuthSetup(event) {
12796 event.preventDefault();
12797 const statusEl = document.getElementById('setup-status');
12798 const btn = document.getElementById('setup-btn');
12799
12800 const username = document.getElementById('setup-username').value.trim();
12801 const password = document.getElementById('setup-password').value;
12802 const confirm = document.getElementById('setup-confirm-password').value;
12803
12804 if (password !== confirm) {
12805 statusEl.className = 'p-3 rounded-lg text-sm bg-red-900/30 border border-red-700 text-red-300';
12806 statusEl.textContent = 'Passwords do not match';
12807 statusEl.classList.remove('hidden');
12808 return;
12809 }
12810
12811 btn.disabled = true;
12812 btn.textContent = 'Setting up...';
12813
12814 try {
12815 const result = await postAPI('/api/auth/setup', {
12816 username, password, confirm_password: confirm
12817 });
12818
12819 if (result.success) {
12820 // Show recovery codes in a prominent way
12821 statusEl.className = 'p-3 rounded-lg text-sm bg-green-900/30 border border-green-700 text-green-300';
12822 statusEl.innerHTML = 'Authentication enabled! Save your recovery codes below.';
12823 statusEl.classList.remove('hidden');
12824

Callers 1

displayConfigFormFunction · 0.70

Calls 4

errorMethod · 0.80
postAPIFunction · 0.70
addConsoleMessageFunction · 0.70
refreshDashboardFunction · 0.70

Tested by

no test coverage detected