|  |  |  | @ -137,4 +137,27 @@ module.exports.getAllOrders = async (req, res) => { | 
		
	
		
			
				|  |  |  |  |     console.error(error); | 
		
	
		
			
				|  |  |  |  |     res.status(500).json({ message: 'Error retrieving Orders' }); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | }; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | // reset password controller
 | 
		
	
		
			
				|  |  |  |  | module.exports.resetPassword = async (req, res) => { | 
		
	
		
			
				|  |  |  |  |   try { | 
		
	
		
			
				|  |  |  |  |     // Get user ID from the JWT token passed in the authorization headers
 | 
		
	
		
			
				|  |  |  |  |     const userId = req.user.id; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // Get the new password from the request body
 | 
		
	
		
			
				|  |  |  |  |     const { newPassword } = req.body; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // Hash the new password
 | 
		
	
		
			
				|  |  |  |  |     const hashedPassword = await bcrypt.hash(newPassword, 10); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // Update the user's password in the database
 | 
		
	
		
			
				|  |  |  |  |     await User.findByIdAndUpdate(userId, { password: hashedPassword }); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     res.status(200).json(true); | 
		
	
		
			
				|  |  |  |  |   } catch (error) { | 
		
	
		
			
				|  |  |  |  |     console.error(error); | 
		
	
		
			
				|  |  |  |  |     res.status(500).json(false); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | }; |