Browse Source

Fixed issue where incorrect login counter would increment when no login was attempted.

pull/33/head
jrtechs 6 years ago
parent
commit
9129034e91
1 changed files with 15 additions and 10 deletions
  1. +15
    -10
      admin/login/login.js

+ 15
- 10
admin/login/login.js View File

@ -25,21 +25,26 @@ const processLogin = function(request, clientAddress)
if(!post.username && !post.password) if(!post.username && !post.password)
{ {
resolve(""); resolve("");
return(false); // no login attempted
} }
return sql.checkLogin(postData); return sql.checkLogin(postData);
}).then(function(loginResult) }).then(function(loginResult)
{ {
if(loginResult.pass)
if(loginResult !== false)
{ {
request.session.user = loginResult.user;
console.log("user has logged in");
resolve("<meta http-equiv=\"refresh\" content=\"0\">");
}
else
{
banIP(clientAddress);
console.log("Invader!");
resolve("Wrong!");
if(loginResult.pass)
{
//what actually logs in the user
request.session.user = loginResult.user;
console.log("user has logged in");
resolve("<meta http-equiv=\"refresh\" content=\"0\">");
}
else
{
banIP(clientAddress);
console.log("Invader!");
resolve("Wrong!");
}
} }
}).catch(function(err) }).catch(function(err)
{ {

Loading…
Cancel
Save