mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: 404 request if payload invalid
This commit is contained in:
@@ -125,14 +125,14 @@ const doUnsubscribe = async (payload) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
settingsController.unsubscribe = async (req, res) => {
|
||||
settingsController.unsubscribe = async (req, res, next) => {
|
||||
if (req.method === 'HEAD') {
|
||||
return res.sendStatus(204);
|
||||
}
|
||||
try {
|
||||
const payload = await jwtVerifyAsync(req.params.token);
|
||||
if (!payload || !unsubscribable.includes(payload.template)) {
|
||||
return;
|
||||
return next();
|
||||
}
|
||||
await doUnsubscribe(payload);
|
||||
res.render('unsubscribe', {
|
||||
|
||||
Reference in New Issue
Block a user