feat: nicer error handling for bad jwt in unsubscribe template

This commit is contained in:
Julian Lam
2022-01-14 15:34:46 -05:00
parent c9fabb0e1d
commit 31ea2266a6
3 changed files with 8 additions and 4 deletions

View File

@@ -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",

View File

@@ -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.",

View File

@@ -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,
});
}
};