From 9ec51ea3d4361d67f1fca95d44a95c5fdd78100a Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 25 Aug 2021 06:00:39 -0500 Subject: [PATCH] Add password verification --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 5414628..4800640 100644 --- a/server.js +++ b/server.js @@ -882,7 +882,7 @@ function submitBuild(req,res,db,send) { db.query('select users.username from builds join users on users_id=users.id where builds.id=$1',[req.body.id]) .then((data)=>{ console.log(data.rows) - if (data.rows.length>0&&data.rows[0].username===req.body.username) { + if (data.rows.length>0&&data.rows[0].username===req.body.username&&data.rows[0].password_hash===sh.SecretHash(req.body.pass)) { return db.query('update builds set creator=$1,build_name=$2,class1=(SELECT id from class WHERE name=$3 limit 1),class2=(SELECT id from class WHERE name=$4 limit 1),last_modified=$5,data=$6 where id=$7 returning id',[req.body.creator,req.body.build_name,req.body.class1,req.body.class2,new Date(),req.body.data,req.body.id]) .then((data)=>{ if (send) {