From 4ebbd04c992a6fd451b1131fae3efaf1b4a9e5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Y=C3=BBki=20Vachot?= Date: Sat, 4 Dec 2021 10:38:20 +0100 Subject: [PATCH] Update: User.controller.auth --- app-backend/controllers/user.controller.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app-backend/controllers/user.controller.js b/app-backend/controllers/user.controller.js index 12dc242..1609157 100644 --- a/app-backend/controllers/user.controller.js +++ b/app-backend/controllers/user.controller.js @@ -13,10 +13,9 @@ exports.auth = (req, res) => { } else{ // Check User in the database User - .findOne({email: req.body.email, hashPass: req.body.hashPass, isActive: true}, {role: true}) + .findOne({email: req.body.email, hashPass: req.body.hashPass, isActive: true}, {role: true, profileImageUrl: true}) .then(data => { if (data !== null){ - console.log(data._id.toString(), {lastConnexion: new Date()}); User.findByIdAndUpdate(data._id.toString(), {lastConnexion: new Date()}, {useFindAndModify: false}); const dataRes = {id: data._id.toString(), email: req.body.email, profileImageUrl: data.profileImageUrl, role: data.role}; setSessionCookie(req, res, dataRes);