Merge pull request #354 from bluewave-labs/feat/add-user-to-reset-password-return

Add user to response
This commit is contained in:
Alexander Holliday
2024-07-16 14:25:30 -07:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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);
}