fix auto plugins not working if someone was allowed in through purgatory

This commit is contained in:
KingKDot
2026-03-29 14:03:05 -05:00
parent ecf84d8a27
commit a55c3193e0
2 changed files with 35 additions and 3 deletions
@@ -15,6 +15,12 @@ import { logAudit, AuditAction } from "../../auditLog";
import * as clientManager from "../../clientManager";
import { setOnlineState } from "../../db";
let _postApproveHook: ((clientId: string) => void) | undefined;
export function setPostApproveHook(hook: (clientId: string) => void): void {
_postApproveHook = hook;
}
export async function handleEnrollmentRoutes(
req: Request,
url: URL,
@@ -62,6 +68,8 @@ export async function handleEnrollmentRoutes(
setClientEnrollmentStatus(clientId, "approved", user.username);
_postApproveHook?.(clientId);
logAudit({
timestamp: Date.now(),
username: user.username,
@@ -175,7 +183,12 @@ export async function handleEnrollmentRoutes(
status as "approved" | "denied" | "pending",
action === "approve" ? user.username : undefined,
);
if (ok) updated++;
if (ok) {
updated++;
if (action === "approve") {
_postApproveHook?.(id);
}
}
}
logAudit({