Browse Source

Fixed bug where user's ban counter would increment when no login attempt was made.

pull/35/head
jrtechs 6 years ago
parent
commit
f54fd2371d
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; if(loginResult.pass)
console.log("user has logged in"); {
resolve("<meta http-equiv=\"refresh\" content=\"0\">"); //what actually logs in the user
} request.session.user = loginResult.user;
else console.log("user has logged in");
{ resolve("<meta http-equiv=\"refresh\" content=\"0\">");
banIP(clientAddress); }
console.log("Invader!"); else
resolve("Wrong!"); {
banIP(clientAddress);
console.log("Invader!");
resolve("Wrong!");
}
} }
}).catch(function(err) }).catch(function(err)
{ {

|||||||
x
 
000:0
Loading…
Cancel
Save