Update: Auth refused is the role is not accepted

This commit is contained in:
Yûki VACHOT 2021-12-12 01:49:58 +01:00
parent d6752acaad
commit cf6264cc87

View file

@ -15,7 +15,7 @@ exports.auth = (req, res) => {
} else{ } else{
// Check User in the database // Check User in the database
User User
.findOne({email: req.body.email, hashPass: req.body.hashPass, isActive: true}, {role: true, profileImageUrl: true}) .findOne({email: req.body.email, hashPass: req.body.hashPass, isActive: true, "role.isAccepted": true}, {role: true, profileImageUrl: true})
.then(data => { .then(data => {
if (data !== null){ if (data !== null){
User.findByIdAndUpdate(data._id.toString(), {lastConnexion: new Date()}, {useFindAndModify: false}, User.findByIdAndUpdate(data._id.toString(), {lastConnexion: new Date()}, {useFindAndModify: false},