From 61d65f700ee4bbe1c1492b16098a8e0b89de21f1 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 16 Jul 2024 14:23:42 -0700 Subject: [PATCH] Add user to response --- Server/controllers/authController.js | 4 ++-- Server/db/MongoDB.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/controllers/authController.js b/Server/controllers/authController.js index a4fe598d1..51ee2dac1 100644 --- a/Server/controllers/authController.js +++ b/Server/controllers/authController.js @@ -309,11 +309,11 @@ const validateRecoveryTokenController = async (req, res, next) => { const resetPasswordController = async (req, res, next) => { try { await newPasswordValidation.validateAsync(req.body); - const token = await req.db.resetPassword(req, res); + const response = await req.db.resetPassword(req, res); res.status(200).json({ success: true, msg: successMessages.AUTH_RESET_PASSWORD, - data: token, + data: response, }); } catch (error) { error.service = SERVICE_NAME; diff --git a/Server/db/MongoDB.js b/Server/db/MongoDB.js index 1170134de..4b225b543 100644 --- a/Server/db/MongoDB.js +++ b/Server/db/MongoDB.js @@ -221,7 +221,7 @@ const resetPassword = async (req, res) => { .select("-password") .select("-profileImage"); const token = issueToken(userWithoutPassword); - return token; + return { user: userWithoutPassword, token: token }; } else { throw new Error(errorMessages.DB_USER_NOT_FOUND); }