forgot password on active user only

This commit is contained in:
lesion 2023-10-25 09:58:30 +02:00
parent deb2367a44
commit 25165fd1da
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -11,7 +11,7 @@ const userController = {
async forgotPassword (req, res) {
const email = req.body.email
const user = await User.findOne({ where: { email: { [Op.eq]: email } } })
const user = await User.findOne({ where: { email, is_active: true } })
if (!user) { return res.sendStatus(200) }
user.recover_code = crypto.randomBytes(16).toString('hex')