Banned users can't vote

This commit is contained in:
Ajay Ramachandran
2020-07-26 11:13:36 -04:00
parent 15fb572b80
commit 4bfa5e7de8
2 changed files with 26 additions and 4 deletions

View File

@@ -249,6 +249,7 @@ async function voteOnSponsorTime(req, res) {
// Only change the database if they have made a submission before and haven't voted recently
let ableToVote = isVIP
|| (db.prepare("get", "SELECT userID FROM sponsorTimes WHERE userID = ?", [nonAnonUserID]) !== undefined
&& privateDB.prepare("get", "SELECT userID FROM shadowBannedUsers WHERE userID = ?", [nonAnonUserID]) === undefined
&& privateDB.prepare("get", "SELECT UUID FROM votes WHERE UUID = ? AND hashedIP = ? AND userID != ?", [UUID, hashedIP, userID]) === undefined);
if (ableToVote) {