fix(security): Prevent email enumeration

This commit is contained in:
Simba Chawanda
2024-04-25 09:27:37 +02:00
parent f5f35f2c37
commit ed70314686
@@ -114,10 +114,7 @@ router.post('/send-pass-recovery-email', express.json(), body_parser_error_handl
});
// Send response
if(req.body.username)
return res.send({message: `Password recovery sent to the email associated with <strong>${user.username}</strong>. Please check your email for instructions on how to reset your password.`});
else
return res.send({message: `Password recovery email sent to <strong>${user.email}</strong>. Please check your email for instructions on how to reset your password.`});
return res.send({message: `If the email address exists in our database. A recovery email will be sent to <strong>${user.email}</strong>`});
}catch(e){
console.log(e)
@@ -126,4 +123,4 @@ router.post('/send-pass-recovery-email', express.json(), body_parser_error_handl
})
module.exports = router
module.exports = router