From 6b3ead747b1395d8ea2b3d135a5ac24db05e2eb8 Mon Sep 17 00:00:00 2001 From: Paul Nothaft Date: Thu, 22 Jan 2026 09:38:49 +0100 Subject: [PATCH] fix: resend gallery email fails for events without password Added optional chaining when accessing req.body.password in the resend-email endpoint to handle cases where req.body is undefined. This prevented the "Cannot read properties of undefined" error. Fixes #137 --- backend/src/routes/adminEvents.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/routes/adminEvents.js b/backend/src/routes/adminEvents.js index 3bb8d774..a86b15e1 100644 --- a/backend/src/routes/adminEvents.js +++ b/backend/src/routes/adminEvents.js @@ -946,7 +946,8 @@ router.post('/:id/resend-email', adminAuth, requirePermission('events.edit'), as // For resending creation email, we need the actual password // First, try to get it from the request body if provided - let galleryPassword = req.body.password; + // Use optional chaining to handle cases where req.body might be undefined + let galleryPassword = req.body?.password; // If no password provided, we can't decrypt the existing one // So we'll show a security message