강제 로그인 기능 추가

This commit is contained in:
static
2025-07-11 23:15:35 +09:00
parent fa8c163347
commit c47885d571
18 changed files with 187 additions and 98 deletions

View File

@@ -5,12 +5,12 @@ import { verifySessionUpgradeChallenge } from "$lib/server/services/auth";
import type { RequestHandler } from "./$types";
export const POST: RequestHandler = async ({ locals, request }) => {
const { sessionId } = await authorize(locals, "notClient");
const { sessionId, userId } = await authorize(locals, "notClient");
const zodRes = sessionUpgradeVerifyRequest.safeParse(await request.json());
if (!zodRes.success) error(400, "Invalid request body");
const { id, answerSig } = zodRes.data;
const { id, answerSig, force } = zodRes.data;
await verifySessionUpgradeChallenge(sessionId, locals.ip, id, answerSig);
await verifySessionUpgradeChallenge(sessionId, userId, locals.ip, id, answerSig, force);
return text("Session upgraded", { headers: { "Content-Type": "text/plain" } });
};