f037-access-tatort-via-token #12

Merged
trachi93 merged 4 commits from f037-access-tatort-via-token into development 2025-06-25 13:35:49 +02:00
Showing only changes of commit ded024bc67 - Show all commits

View File

@@ -1,5 +1,4 @@
import { loginUser, logoutUser } from '$lib/server/authService';
import { checkIfVorgangExists, hasValidToken } from '$lib/server/vorgangService.js';
import { redirect } from '@sveltejs/kit';
export const actions = {
@@ -9,12 +8,9 @@ export const actions = {
const data = await request.formData();
const caseId = data.get('case-id');
const caseToken = data.get('case-token');
const isVorgangValid = await checkIfVorgangExists(caseId);
if (!isVorgangValid) return isVorgangValid;
const isTokenValid = await hasValidToken(caseId, caseToken);
if (!isTokenValid) return isTokenValid;
if (!caseId || !caseToken) return;
throw redirect(303, `/list/${caseId}?token=${caseToken}`);
}
} as const;
} as const;