Skip to content

Commit

Permalink
Add banlist
Browse files Browse the repository at this point in the history
Closes #38
  • Loading branch information
foodelevator committed Jan 20, 2024
1 parent 6584e62 commit 5542b4c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/auth.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var Future = Npm.require('fibers/future')

var banlist = (process.env.BANLIST || "").split(",")

Accounts.registerLoginHandler("kth", function(loginRequest) {
var future = new Future
Expand All @@ -16,6 +17,13 @@ Accounts.registerLoginHandler("kth", function(loginRequest) {
})
var userId
if(user) {
for (var i = 0; i < banlist.length; i++) {
if (banlist[i] == user.username) {
console.log("Denied log in of banned user", user.username)
future.return(undefined)
return
}
}
future.return({
userId: user._id,
token: loginRequest.token
Expand Down

0 comments on commit 5542b4c

Please sign in to comment.