translated error
This commit is contained in:
		@@ -6,6 +6,7 @@ import AbstractProductService from '../services/abstractproduct.js';
 | 
			
		||||
import ProductService from '../services/product.js';
 | 
			
		||||
import translate from '../utils/translate.js';
 | 
			
		||||
import responseCodes from '../response/responseCodes.js';
 | 
			
		||||
import customError from '../response/customError.js';
 | 
			
		||||
 | 
			
		||||
const TAG = "/controllers/userjs"
 | 
			
		||||
 | 
			
		||||
@@ -23,7 +24,7 @@ class UserController {
 | 
			
		||||
        const { username, password } = req.body;
 | 
			
		||||
 | 
			
		||||
        const user = await UserService.getByUsername(username);
 | 
			
		||||
        if (!bcrypt.compareSync(password, user.password)) return res.status(401).send("Wrong password");
 | 
			
		||||
        if (!bcrypt.compareSync(password, user.password)) throw new customError(`Wrong user password`, responseCodes.responses.passwords.invalid);
 | 
			
		||||
 | 
			
		||||
        const token = genToken(user);
 | 
			
		||||
        return res.status(200).send(token);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user