diff --git a/src/services/auth.service.js b/src/services/auth.service.js index 6ef5eb63..1652e1d0 100644 --- a/src/services/auth.service.js +++ b/src/services/auth.service.js @@ -64,8 +64,8 @@ const resetPassword = async (resetPasswordToken, newPassword) => { if (!user) { throw new Error(); } - await Token.deleteMany({ user: user.id, type: tokenTypes.RESET_PASSWORD }); await userService.updateUserById(user.id, { password: newPassword }); + await Token.deleteMany({ user: user.id, type: tokenTypes.RESET_PASSWORD }); } catch (error) { throw new ApiError(httpStatus.UNAUTHORIZED, 'Password reset failed'); }