From 9129034e91a9bf2cdb220190b57cb20208a90372 Mon Sep 17 00:00:00 2001 From: jrtechs Date: Sun, 11 Nov 2018 21:09:51 -0500 Subject: [PATCH] Fixed issue where incorrect login counter would increment when no login was attempted. --- admin/login/login.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/admin/login/login.js b/admin/login/login.js index d2185e8..a8da076 100644 --- a/admin/login/login.js +++ b/admin/login/login.js @@ -25,21 +25,26 @@ const processLogin = function(request, clientAddress) if(!post.username && !post.password) { resolve(""); + return(false); // no login attempted } return sql.checkLogin(postData); }).then(function(loginResult) { - if(loginResult.pass) + if(loginResult !== false) { - request.session.user = loginResult.user; - console.log("user has logged in"); - resolve(""); - } - 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(""); + } + else + { + banIP(clientAddress); + console.log("Invader!"); + resolve("Wrong!"); + } } }).catch(function(err) {