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
This commit is contained in:
Paul Nothaft
2026-01-22 09:38:49 +01:00
parent dadef81158
commit 6b3ead747b
+2 -1
View File
@@ -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