f091_PIN-verstecken-in-URL #36

Merged
mina merged 5 commits from f091_PIN-verstecken-in-URL into development 2025-10-13 10:44:44 +02:00
3 changed files with 8 additions and 7 deletions
Showing only changes of commit 468427622f - Show all commits

View File

@@ -1,18 +1,18 @@
import { vorgangPINValidation, vorgangExists } from '$lib/server/vorgangService';
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './list/[vorgang]/$types';
import type { LayoutServerLoad } from './$types';
trachi93 marked this conversation as resolved Outdated
Outdated
Review

da layout.server müsste es LayoutServerLoad sein

da layout.server müsste es LayoutServerLoad sein
import { ROUTE_NAMES } from '..';
export const load: PageServerLoad = async ({ params, cookies, locals }) => {
export const load: LayoutServerLoad = async ({ params, cookies, locals }) => {
if (locals.user) {
return {
user: locals.user
};
}
const vorgangToken = params.vorgang;
const vorgangToken = params.vorgang || '';
const COOKIE_NAME = `token-${vorgangToken}`;
trachi93 marked this conversation as resolved
Review

Auf Typen achten, vorgangPIn/vorgangToken darf nicht undefined sein, ist aber möglich

Auf Typen achten, vorgangPIn/vorgangToken darf nicht undefined sein, ist aber möglich
const vorgangPIN = cookies.get(COOKIE_NAME);
const vorgangPIN = cookies.get(COOKIE_NAME) || '';
const isVorgangValid = vorgangExists(vorgangToken);
const isVorgangPINValid = vorgangPINValidation(vorgangToken, vorgangPIN);

View File

@@ -6,6 +6,7 @@ import { baseData } from '../fixtures';
import { ROUTE_NAMES } from '../../src/routes';
import { dev } from '$app/environment';
import { vorgangExists, vorgangPINValidation } from '$lib/server/vorgangService';
import { Redirect } from '@sveltejs/kit';
vi.mock('$lib/server/vorgangService', () => ({
vorgangExists: vi.fn(),
@@ -34,11 +35,11 @@ describe('Vorgang Anzeige via Token', () => {
}
};
trachi93 marked this conversation as resolved
Review

Typ richtig setzen! Scheint ein Redirect | undefined zu sein.

Typ richtig setzen! Scheint ein Redirect | undefined zu sein.
let thrownRedirect;
let thrownRedirect: Redirect | undefined;
try {
await actions.getVorgangByToken(event);
} catch (e) {
thrownRedirect = e;
thrownRedirect = e as Redirect;
}
// Redirect bei erfolgreicher Eingabe

View File

@@ -8,7 +8,7 @@ export default defineConfig({
resolve: {
alias: {
$lib: path.resolve('./src/lib'),
$root: path.resolve(__dirname, 'src')
$root: path.resolve(__dirname, './src')
}
},
test: {