enforce purgatory
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
const body = document.getElementById("enrollment-body");
|
||||
const loadingRow = document.getElementById("enrollment-loading");
|
||||
const emptyEl = document.getElementById("enrollment-empty");
|
||||
const toggleEl = document.getElementById("require-approval-toggle");
|
||||
const selectAllEl = document.getElementById("select-all");
|
||||
const bulkApproveBtn = document.getElementById("bulk-approve-btn");
|
||||
const bulkDenyBtn = document.getElementById("bulk-deny-btn");
|
||||
@@ -64,13 +63,6 @@ async function loadStats() {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function loadSettings() {
|
||||
try {
|
||||
const s = await api("/api/enrollment/settings");
|
||||
toggleEl.checked = s.requireApproval;
|
||||
} catch {}
|
||||
}
|
||||
|
||||
async function loadClients() {
|
||||
loadingRow.classList.remove("hidden");
|
||||
emptyEl.classList.add("hidden");
|
||||
@@ -242,25 +234,6 @@ document.querySelectorAll(".enrollment-tab").forEach((tab) => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── Toggle require approval ────────────────────────────────────────
|
||||
toggleEl.addEventListener("change", async () => {
|
||||
try {
|
||||
await api("/api/enrollment/settings", {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ requireApproval: toggleEl.checked }),
|
||||
});
|
||||
if (window.showToast)
|
||||
window.showToast(
|
||||
toggleEl.checked ? "Approval required" : "Auto-approve enabled",
|
||||
"success",
|
||||
);
|
||||
} catch (e) {
|
||||
toggleEl.checked = !toggleEl.checked;
|
||||
if (window.showToast) window.showToast(`Failed: ${e.message}`, "error");
|
||||
}
|
||||
});
|
||||
|
||||
// ── Table delegation ───────────────────────────────────────────────
|
||||
body.addEventListener("click", (e) => {
|
||||
const btn = e.target.closest("button");
|
||||
@@ -434,7 +407,6 @@ confirmBanBtn.addEventListener("click", async () => {
|
||||
});
|
||||
|
||||
// ── Init ───────────────────────────────────────────────────────────
|
||||
loadSettings();
|
||||
loadStats();
|
||||
loadClients();
|
||||
|
||||
|
||||
@@ -40,23 +40,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Settings Card -->
|
||||
<div class="mb-6 bg-slate-900/60 border border-slate-800 rounded-xl p-5">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<h3 class="font-semibold text-slate-100">Approval Mode</h3>
|
||||
<p class="text-sm text-slate-400">
|
||||
When enabled, new clients must be approved before connecting.
|
||||
When disabled, clients auto-approve on first connection.
|
||||
</p>
|
||||
</div>
|
||||
<label class="relative inline-flex items-center cursor-pointer">
|
||||
<input type="checkbox" id="require-approval-toggle" class="sr-only peer" />
|
||||
<div class="w-11 h-6 bg-slate-700 peer-focus:ring-2 peer-focus:ring-sky-500 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-slate-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-amber-500"></div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filter Tabs -->
|
||||
<div class="mb-4 flex items-center gap-2 flex-wrap">
|
||||
<button data-filter="pending"
|
||||
|
||||
Reference in New Issue
Block a user