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