Skip to content

Node.js based forum software built for the modern web

feat: nicer error handling for bad jwt in unsubscribe template

Julian Lam31ea2266a68d
diff --git a/install/package.json b/install/package.json
index 3de4a7f156..b52a810420 100644
--- a/install/package.json
+++ b/install/package.json
@@ -94,9 +94,9 @@
"nodebb-plugin-spam-be-gone": "0.7.12",
"nodebb-rewards-essentials": "0.2.1",
"nodebb-theme-lavender": "5.3.2",
- "nodebb-theme-persona": "11.3.13",
+ "nodebb-theme-persona": "11.3.16",
"nodebb-theme-slick": "1.4.23",
- "nodebb-theme-vanilla": "12.1.15",
+ "nodebb-theme-vanilla": "12.1.16",
"nodebb-widget-essentials": "5.0.4",
"nodemailer": "6.7.2",
"nprogress": "0.2.0",
diff --git a/public/language/en-GB/email.json b/public/language/en-GB/email.json
index 8d27730066..15cbf3cf26 100644
--- a/public/language/en-GB/email.json
+++ b/public/language/en-GB/email.json
@@ -61,6 +61,8 @@
"unsub.cta": "Click here to alter those settings",
"unsubscribe": "unsubscribe",
"unsub.success": "You will no longer receive emails from the <strong>%1</strong> mailing list",
+ "unsub.failure.title": "Unable to unsubscribe",
+ "unsub.failure.message": "Unfortunately, we were not able to unsubscribe you from the mailing list, as there was an issue with the link. However, you can alter your email preferences by going to <a href=\"%2\">your user settings</a>.<br /><br />(error: <code>%1</code>)",
"banned.subject": "You have been banned from %1",
"banned.text1": "The user %1 has been banned from %2.",
diff --git a/src/controllers/accounts/settings.js b/src/controllers/accounts/settings.js
index 1331b79d95..824e12af4f 100644
--- a/src/controllers/accounts/settings.js
+++ b/src/controllers/accounts/settings.js
@@ -149,10 +149,12 @@ settingsController.unsubscribe = async (req, res) => {
}
await doUnsubscribe(payload);
res.render('unsubscribe', {
- payload: payload,
+ payload,
});
} catch (err) {
- throw new Error(err);
+ res.render('unsubscribe', {
+ error: err.message,
+ });
}
};