0
I want to login to a site, using Node. The login would perform a select in the database, according to the E-mail entered, and then check if the password is in agreement. In login Submit, I perform select in the database, and user data is displayed on the page in JSON format.
app.post('/login', function(req, res){
var email = req.body.email;
var senha = req.body.senha;
senha = criptografar(senha);
execSQL("select * from Usuario where email = '"+ email+"' ", res);
if(senha == *senha recuperada do json*)
logar();
});
function execSQL(sql, resposta) {
global.conexao.request()
.query(sql)
.then(resultado => resposta.json(resultado.recordset))
.catch(erro => resposta.json(erro));
}
The json displayed on the localhost:3000 page is :
[{
"codUsuario":100,
"nome":"Pedro Pereira",
"cpf":"042.321.123-22",
"email":"[email protected]",
"telefone":"(19)1212-3232",
"senha":"112233",
"peso":50,
"altura":1,
"codNutricionista":4999,
"Pontuação":0
}]
How I got the password displayed on the page?
You need to send the password through the
request
, nay?– Felipe Avelar