Merge pull request #355 from bluewave-labs/fix/token-issuance

Fixed token issue
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-07-16 14:45:37 -07:00
commit 9e0c80f650
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) => { const resetPasswordController = async (req, res, next) => {
try { try {
await newPasswordValidation.validateAsync(req.body); 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({ res.status(200).json({
success: true, success: true,
msg: successMessages.AUTH_RESET_PASSWORD, msg: successMessages.AUTH_RESET_PASSWORD,
data: response, data: { user, token },
}); });
} catch (error) { } catch (error) {
error.service = SERVICE_NAME; error.service = SERVICE_NAME;
+1 -2
View File
@@ -220,8 +220,7 @@ const resetPassword = async (req, res) => {
}) })
.select("-password") .select("-password")
.select("-profileImage"); .select("-profileImage");
const token = issueToken(userWithoutPassword); return userWithoutPassword;
return { user: userWithoutPassword, token: token };
} else { } else {
throw new Error(errorMessages.DB_USER_NOT_FOUND); throw new Error(errorMessages.DB_USER_NOT_FOUND);
} }