Actualizacion de seguridad
This commit is contained in:
@@ -28,32 +28,8 @@ controlador.verVentasJson = (req, res) => {
|
||||
controlador.app_login = (req, res) => {
|
||||
res.render('login');
|
||||
};
|
||||
controlador.auth = (req, res) => {
|
||||
console.log(req.body);
|
||||
var pwd = stringTo_md5(req.body.password);
|
||||
req.getConnection((error, conn, next) => {
|
||||
conn.query(`SELECT * FROM usuarios WHERE n_sesion = ? and clave=?`, [req.body.usuario, pwd], (err, rows) => {
|
||||
if (err) {
|
||||
//res.json(err);
|
||||
res.json("No Autorizado");
|
||||
} else {
|
||||
try {
|
||||
if (rows.length > 0) {
|
||||
//res.json({sision:"exitosa"});
|
||||
|
||||
console.log(rows);
|
||||
res.render('app_pedidos');
|
||||
}
|
||||
} catch (e) {
|
||||
res.render('login');
|
||||
next();
|
||||
}
|
||||
}
|
||||
});
|
||||
//conn.end();
|
||||
});
|
||||
|
||||
//res.render('');
|
||||
controlador.auth_redirect = (req, res) => {
|
||||
res.render('login');
|
||||
};
|
||||
function stringTo_md5(data_string) {
|
||||
var crypto = require('crypto');
|
||||
|
||||
@@ -256,5 +256,51 @@ controlador.item_xCat = (req, res) => {
|
||||
});
|
||||
};
|
||||
|
||||
controlador.app_itemsTab = (req, res) => {
|
||||
var items="";
|
||||
var btnAdd = `
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#myModal">
|
||||
<span class="glyphicon glyphicon-plus"></span> Agregar Ítem
|
||||
</button>
|
||||
</td>
|
||||
</tr>`;
|
||||
var detalle = `
|
||||
<tr>
|
||||
<td colspan="5" class="text-right">
|
||||
<h4>TOTAL USD</h4>
|
||||
</td>
|
||||
<th class="text-right">
|
||||
<h4>111.00</h4>
|
||||
</th>
|
||||
<td></td>
|
||||
</tr>`;
|
||||
req.getConnection((err, conn) => { //se obtiene error o consulta filas(rows)
|
||||
conn.query('select * from ver_detallePedidos where idPedido=97', (err, rows) => {
|
||||
try {
|
||||
if (rows.length > 0) {
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
items += `<tr>
|
||||
<td class="text-center">${rows[i].codigoProducto}</td>
|
||||
<td class="text-center">${rows[i].cant_pdcto}</td>
|
||||
<td class="text-center">${rows[i].descipcion}</td>
|
||||
<td class="text-center">${rows[i].costo}</td>
|
||||
<td class="text-center">${(rows[i].cant_pdcto*rows[i].costo)}</td>
|
||||
<td class="text-right"><a href="#" onclick="eliminar_item('${rows[i].codigoProducto}')"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAeFBMVEUAAADnTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDznTDx+VWpeAAAAJ3RSTlMAAQIFCAkPERQYGi40TVRVVlhZaHR8g4WPl5qdtb7Hys7R19rr7e97kMnEAAAAaklEQVQYV7XOSQKCMBQE0UpQwfkrSJwCKmDf/4YuVOIF7F29VQOA897xs50k1aknmnmfPRfvWptdBjOz29Vs46B6aFx/cEBIEAEIamhWc3EcIRKXhQj/hX47nGvt7x8o07ETANP2210OvABwcxH233o1TgAAAABJRU5ErkJggg=="></a></td>
|
||||
</tr>`;
|
||||
console.log(rows[0].codigoProducto);
|
||||
}
|
||||
|
||||
res.send(items+btnAdd+detalle);
|
||||
} else {
|
||||
res.json({ auth: false, message: 'Unauthorized' });
|
||||
}
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = controlador;
|
||||
|
||||
Reference in New Issue
Block a user