Fix: Server crashed when logging in with wrong credentials
This commit is contained in:
parent
0985aaf96f
commit
7905a88e62
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) => {
|
con.query("SELECT PASSWORT, USERNAME FROM ministranten WHERE (USERNAME='" + id + "' OR EMAIL='" + id + "')", (err, result) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
if(password == result[0]["PASSWORT"]){
|
if(result[0] != null && password == result[0]["PASSWORT"]){
|
||||||
var usertoken = uuid();
|
var usertoken = uuid();
|
||||||
res.cookie("loginToken", usertoken);
|
res.cookie("loginToken", usertoken);
|
||||||
res.cookie("user", result[0]["USERNAME"]);
|
res.cookie("user", result[0]["USERNAME"]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user