fpavon-ee-shared 1.0.30 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -67,13 +67,11 @@ const validarToken = (req, res, next) => __awaiter(void 0, void 0, void 0, funct
|
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
let token = bearer[1].replace(/['"]+/g, '');
|
|
70
|
-
console.error("DEBUG: Token extraído:", token);
|
|
71
70
|
const secret = getSecret(); // Asumimos que esta función devuelve el Buffer/String limpio
|
|
72
71
|
// jwt.verify es el principal punto de fallo del token (expiración, firma incorrecta)
|
|
73
72
|
let data;
|
|
74
73
|
try {
|
|
75
74
|
data = jwt.verify(token, secret);
|
|
76
|
-
console.error("DEBUG: JWT Verificado con ÉXITO. Payload:", data.afiliado);
|
|
77
75
|
}
|
|
78
76
|
catch (jwtError) {
|
|
79
77
|
console.error("FALLO CRÍTICO: Error de Verificación JWT:", jwtError);
|
|
@@ -91,7 +89,6 @@ const validarToken = (req, res, next) => __awaiter(void 0, void 0, void 0, funct
|
|
|
91
89
|
const queryVerificar = `SELECT logueado, idNavegador FROM Usuarios WHERE afiliado = '${data.afiliado}'`;
|
|
92
90
|
// getConnection es el principal punto de fallo de BD.
|
|
93
91
|
const result = yield (0, connection_sql_1.getConnection)(queryVerificar);
|
|
94
|
-
console.error("DEBUG: Consulta de usuario exitosa.");
|
|
95
92
|
if (result.recordset.length === 0) {
|
|
96
93
|
res.status(401).json({ status: false, mensaje: "Usuario no encontrado" });
|
|
97
94
|
return;
|
|
@@ -110,7 +107,6 @@ const validarToken = (req, res, next) => __awaiter(void 0, void 0, void 0, funct
|
|
|
110
107
|
// ... (TODO EL CÓDIGO DE req.body.propiedad = data.propiedad)
|
|
111
108
|
if (!req.body) {
|
|
112
109
|
req.body = {};
|
|
113
|
-
console.error("DEBUG: req.body fue inicializado como objeto vacío.");
|
|
114
110
|
}
|
|
115
111
|
req.body.token = token;
|
|
116
112
|
req.body.nombreGerencia = data.nombreGerencia;
|
|
@@ -38,7 +38,7 @@ const validarToken = async (req: Request, res: Response, next: NextFunction): Pr
|
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
let token = bearer[1].replace(/['"]+/g, '');
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
|
|
43
43
|
const secret = getSecret(); // Asumimos que esta función devuelve el Buffer/String limpio
|
|
44
44
|
|
|
@@ -46,7 +46,7 @@ const validarToken = async (req: Request, res: Response, next: NextFunction): Pr
|
|
|
46
46
|
let data: any;
|
|
47
47
|
try {
|
|
48
48
|
data = jwt.verify(token, secret);
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
} catch (jwtError) {
|
|
51
51
|
console.error("FALLO CRÍTICO: Error de Verificación JWT:", jwtError);
|
|
52
52
|
res.status(401).json({ status: false, mensaje: "token inválido (firma o expiración)" });
|
|
@@ -66,7 +66,7 @@ const validarToken = async (req: Request, res: Response, next: NextFunction): Pr
|
|
|
66
66
|
|
|
67
67
|
// getConnection es el principal punto de fallo de BD.
|
|
68
68
|
const result = await getConnection(queryVerificar);
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
|
|
71
71
|
if (result.recordset.length === 0) {
|
|
72
72
|
res.status(401).json({ status: false, mensaje: "Usuario no encontrado" });
|
|
@@ -90,7 +90,7 @@ const validarToken = async (req: Request, res: Response, next: NextFunction): Pr
|
|
|
90
90
|
// ... (TODO EL CÓDIGO DE req.body.propiedad = data.propiedad)
|
|
91
91
|
if (!req.body) {
|
|
92
92
|
req.body = {};
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
}
|
|
95
95
|
req.body.token = token;
|
|
96
96
|
|