feat: return generic 404 on invalid confirm code

v1.18.x
Julian Lam 4 years ago
parent 824a72b220
commit f53fc1ad0b

@ -222,13 +222,20 @@ Controllers.registerInterstitial = async function (req, res, next) {
} }
}; };
Controllers.confirmEmail = function (req, res) { Controllers.confirmEmail = async (req, res, next) => {
user.email.confirmByCode(req.params.code, (err) => { try {
await user.email.confirmByCode(req.params.code, req.session.id);
} catch (e) {
if (e.message === '[[error:invalid-data]]') {
return next();
}
throw e;
}
res.render('confirm', { res.render('confirm', {
error: err ? err.message : '',
title: '[[pages:confirm]]', title: '[[pages:confirm]]',
}); });
});
}; };
Controllers.robots = function (req, res) { Controllers.robots = function (req, res) {

Loading…
Cancel
Save