prevent login using bad account
This commit is contained in:
parent
3262dcdb67
commit
f3dcf43337
1 changed files with 6 additions and 2 deletions
|
@ -10,7 +10,8 @@ router.post('/auth', function(request, response) {
|
|||
let user = User.findOne({
|
||||
name: username, pass: password
|
||||
}, function(err, results) {
|
||||
console.log(results.name);
|
||||
if (results !=null) {
|
||||
console.log(results.name);
|
||||
if (results.name.length > 0) {
|
||||
request.session.loggedin = true;
|
||||
request.session.username = username;
|
||||
|
@ -20,7 +21,10 @@ router.post('/auth', function(request, response) {
|
|||
response.send('Incorrect Username and/or Password!');
|
||||
}
|
||||
response.end();
|
||||
});
|
||||
} else {
|
||||
response.send('Use a registered username Please.')
|
||||
}
|
||||
});
|
||||
} else {
|
||||
response.send('Please enter Username and Password!');
|
||||
response.end();
|
||||
|
|
Loading…
Reference in a new issue