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

Function saveAIToken

web/scripts/ragnar_modern.js:12900–12952  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12898 if (badge) { badge.classList.remove('hidden'); }
12899 if (summary) {
12900 summary.innerHTML = '<p class="text-sm text-green-400">Authentication is enabled. Database is encrypted and hardware-bound. Expand to manage.</p>';
12901 }
12902 } else {
12903 if (badge) { badge.classList.add('hidden'); }
12904 if (summary) {
12905 summary.innerHTML = '<p class="text-sm text-red-400">Set up authentication to protect your Ragnar instance. Once enabled, all access will require login. The database will be encrypted and bound to this hardware.</p>';
12906 }
12907 }
12908
12909 if (!status.configured) {
12910 // Show setup form
12911 container.innerHTML = `
12912 <div class="mb-4">
12913 <div class="p-3 rounded-lg bg-yellow-900/30 border border-yellow-700 text-sm text-yellow-300 mb-4">
12914 Warning: Once authentication is enabled, you will need your password or recovery codes to access Ragnar.
12915 Make sure to save your recovery codes in a safe place.
12916 </div>
12917 </div>
12918 <form id="auth-setup-form" onsubmit="handleAuthSetup(event)" class="space-y-4">
12919 <div>
12920 <label class="block text-sm font-medium text-gray-300 mb-2">Username</label>
12921 <input type="text" id="setup-username" required autocomplete="username"
12922 class="w-full px-4 py-2 rounded-lg bg-slate-700 border border-slate-600 text-white placeholder-gray-400 focus:ring-2 focus:ring-sky-500 focus:border-transparent outline-none"
12923 placeholder="Choose a username">
12924 </div>
12925 <div>
12926 <label class="block text-sm font-medium text-gray-300 mb-2">Password</label>
12927 <input type="password" id="setup-password" required minlength="8" autocomplete="new-password"
12928 class="w-full px-4 py-2 rounded-lg bg-slate-700 border border-slate-600 text-white placeholder-gray-400 focus:ring-2 focus:ring-sky-500 focus:border-transparent outline-none"
12929 placeholder="Minimum 8 characters">
12930 </div>
12931 <div>
12932 <label class="block text-sm font-medium text-gray-300 mb-2">Confirm Password</label>
12933 <input type="password" id="setup-confirm-password" required minlength="8" autocomplete="new-password"
12934 class="w-full px-4 py-2 rounded-lg bg-slate-700 border border-slate-600 text-white placeholder-gray-400 focus:ring-2 focus:ring-sky-500 focus:border-transparent outline-none"
12935 placeholder="Confirm password">
12936 </div>
12937 <div id="setup-status" class="hidden p-3 rounded-lg text-sm"></div>
12938 <button type="submit" id="setup-btn"
12939 class="w-full bg-sky-600 hover:bg-sky-700 text-white font-semibold py-2 px-4 rounded-lg transition-colors">
12940 Enable Authentication
12941 </button>
12942 </form>
12943 `;
12944 } else {
12945 // Show management panel
12946 let hwBadge = status.hw_match
12947 ? '<span class="text-green-400 text-xs">Hardware matched</span>'
12948 : '<span class="text-red-400 text-xs">Hardware mismatch!</span>';
12949
12950 container.innerHTML = `
12951 <div class="space-y-4">
12952 <div class="flex items-center justify-between">
12953 <div>
12954 <span class="text-green-400 font-medium">Authentication Enabled</span>
12955 <span class="mx-2 text-gray-500">|</span>

Callers

nothing calls this directly

Calls 7

addMethod · 0.80
errorMethod · 0.80
postAPIFunction · 0.70
addConsoleMessageFunction · 0.70
fetchAPIFunction · 0.70
loadAIConfigurationFunction · 0.70
refreshDashboardFunction · 0.70

Tested by

no test coverage detected