correction bug
This commit is contained in:
parent
d1b502c110
commit
51558b193f
|
@ -19,20 +19,18 @@ module.exports=function(req,res,next){
|
|||
req.session.userName = name;
|
||||
req.session.authStatus = true;
|
||||
req.session.authMessage = 'OK';
|
||||
|
||||
console.log(name + " SUCESSFULL LOGED");
|
||||
next();
|
||||
} else {
|
||||
|
||||
console.log(name + " BAD PASSWORD");
|
||||
req.session.authStatus = false,
|
||||
req.session.authMessage = "BAD PASSWORD";
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
if(req.body.password != "")
|
||||
{
|
||||
} else {
|
||||
if (req.body.password != "") {
|
||||
var users = {
|
||||
"userName": req.body.username,
|
||||
"pw": passwordProtection(req.body.password)
|
||||
|
@ -41,7 +39,7 @@ module.exports=function(req,res,next){
|
|||
if (error) {
|
||||
//res.local.stat = 0;
|
||||
res.locals.message = '0';
|
||||
console.log("ERROR SQL LOGIN-CONTROLLER : "+console.error);
|
||||
console.log("ERROR SQL LOGIN-CONTROLLER : " + error);
|
||||
req.session.authStatus = false;
|
||||
req.session.authMessage = 'SQL INSERT ERROR';
|
||||
next();
|
||||
|
@ -49,17 +47,18 @@ module.exports=function(req,res,next){
|
|||
req.session.userName = name;
|
||||
req.session.authStatus = true;
|
||||
req.session.authMessage = 'SQL INSERT OK';
|
||||
console.log(name + "SUCESSFULL REGISTER"+req.session.authMessage);
|
||||
next();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
req.session.userName = name;
|
||||
req.session.authStatus = true;
|
||||
req.session.authMessage = 'AUTH WITHOUT REG OK';
|
||||
console.log(name + "SUCESSFULL LOGED WITHOUTH PW");
|
||||
next();
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
4
index.js
4
index.js
|
@ -28,9 +28,7 @@ app.get('/', function(req, res){
|
|||
res.redirect('/login');
|
||||
}).get('/login', function(req, res){
|
||||
res.render('login');
|
||||
}).post('/login', function(req,res,next){
|
||||
next();
|
||||
}, loginController, function(req, res){
|
||||
}).post('/login', loginController, function(req, res){
|
||||
res.send('<!DOCTYPE html><html><body>'+req.session.authMessage+'<br><a href="/">HOME</a></body></html>');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue