rewrite vorgang exist and token validation check to use DB
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { checkIfVorgangExists, hasValidToken } from '$lib/server/vorgangService';
|
||||
import {
|
||||
checkIfVorgangExists,
|
||||
hasValidToken,
|
||||
tokenValid,
|
||||
vorgangExists
|
||||
} from '$lib/server/vorgangService';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './list/[vorgang]/$types';
|
||||
|
||||
@@ -12,8 +17,9 @@ export const load: PageServerLoad = async ({ params, url, locals }) => {
|
||||
const caseId = params.vorgang;
|
||||
const caseToken = url.searchParams.get('token');
|
||||
|
||||
const isVorgangValid = await checkIfVorgangExists(caseId);
|
||||
const isTokenValid = await hasValidToken(caseId, caseToken);
|
||||
const isVorgangValid = vorgangExists(caseId);
|
||||
const isTokenValid = tokenValid(caseId, caseToken);
|
||||
console.log(`--- is valid: ${isTokenValid}`);
|
||||
|
||||
if (!isVorgangValid || !isTokenValid) throw redirect(303, `/anmeldung`);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user