[user][bug] validate NEW email, not the old one 🤦

This commit is contained in:
Avris 2021-09-09 20:09:06 +02:00
parent dfd9fb9ed9
commit 3c0d93c7d7
1 changed files with 1 additions and 1 deletions

View File

@ -306,7 +306,7 @@ router.post('/user/change-email', handleErrorAsync(async (req, res) => {
return res.status(401).json({error: 'Unauthorised'});
}
if (!await validateEmail(normalise(req.user.email))) {
if (!await validateEmail(normalise(req.body.email))) {
return res.json({ error: 'user.account.changeEmail.invalid' })
}