Merge remote-tracking branch 'upstream/fix/token-issuance' into feat/form-validation

This commit is contained in:
Daniel Cojocea committed 2024-07-16 17:44:06 -04:00
commit 9b61c1ad66
2 files changed
+4 -4

No files matched your search

+3 -2
View File
@@ -309,11 +309,12 @@ const validateRecoveryTokenController = async (req, res, next) => {
const resetPasswordController = async (req, res, next) => {
try {
await newPasswordValidation.validateAsync(req.body);
const response = await req.db.resetPassword(req, res);
const user = await req.db.resetPassword(req, res);
const token = issueToken(user);
res.status(200).json({
success: true,
msg: successMessages.AUTH_RESET_PASSWORD,
data: response,
data: { user, token },
});
} catch (error) {
error.service = SERVICE_NAME;
+1 -2
View File
@@ -220,8 +220,7 @@ const resetPassword = async (req, res) => {
})
.select("-password")
.select("-profileImage");
const token = issueToken(userWithoutPassword);
return { user: userWithoutPassword, token: token };
return userWithoutPassword;
} else {
throw new Error(errorMessages.DB_USER_NOT_FOUND);
}