membership: refactor form filling, add smoke tests and debug-guard fallback; fix mappings

This commit is contained in:
Torsten Schulz (local)
2025-10-23 14:21:05 +02:00
parent f14597006e
commit e029154a8c
9 changed files with 662 additions and 295 deletions

View File

@@ -45,13 +45,22 @@ export default defineEventHandler(async (event) => {
}
}
// Prüfen ob es sich um eine aktuelle Session handelt (innerhalb der letzten 30 Minuten)
const sessionKey = `download_${fileId}`
const sessionValue = getCookie(event, sessionKey)
// Prüfen ob es sich um eine aktuelle Session handelt (innerhalb der letzten 24 Stunden)
const downloadToken = getCookie(event, 'download_token')
if (sessionValue === 'authorized') {
// Session-basierte Berechtigung für Antragsteller
isAuthorized = true
if (downloadToken) {
try {
const decoded = Buffer.from(downloadToken, 'base64').toString('utf8')
const [tokenFilename, timestamp] = decoded.split(':')
// Prüfen ob der Token für diese Datei ist und nicht älter als 24 Stunden
if (tokenFilename === fileId.replace('.pdf', '') &&
Date.now() - parseInt(timestamp) < 24 * 60 * 60 * 1000) {
isAuthorized = true
}
} catch (e) {
console.warn('Ungültiger Download-Token:', e.message)
}
}
if (!isAuthorized) {