Fix: Server crashed when logging in with wrong credentials
This commit is contained in:
2
app.js
2
app.js
@@ -79,7 +79,7 @@ app.get('/login', (req, res) => {
|
||||
|
||||
con.query("SELECT PASSWORT, USERNAME FROM ministranten WHERE (USERNAME='" + id + "' OR EMAIL='" + id + "')", (err, result) => {
|
||||
if (err) throw err;
|
||||
if(password == result[0]["PASSWORT"]){
|
||||
if(result[0] != null && password == result[0]["PASSWORT"]){
|
||||
var usertoken = uuid();
|
||||
res.cookie("loginToken", usertoken);
|
||||
res.cookie("user", result[0]["USERNAME"]);
|
||||
|
||||
Reference in New Issue
Block a user