From 52b58b441e8cabc88dcf30b0668a5909c7e0c6f9 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 10 Sep 2014 16:04:33 -0400 Subject: [PATCH 1/3] closes https://github.com/NodeBB/NodeBB/issues/2077 --- src/favourites.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/favourites.js b/src/favourites.js index 741d3a3c4f..663bfec5f8 100644 --- a/src/favourites.js +++ b/src/favourites.js @@ -44,6 +44,13 @@ var async = require('async'), db.sortedSetAdd('users:reputation', newreputation, postData.uid); + if (parseInt(meta.config['autoban:downvote'], 10) !== 0 && newreputation < parseInt(meta.config['autoban:downvote:threshold'], 10)) { + var adminUser = require('./socket.io/admin/user'); + adminUser.banUser(postData.uid, function() { + require('winston').info('uid ' + uid + ' was banned for reaching ' + newreputation + ' reputation'); + }); + } + adjustPostVotes(pid, uid, type, unvote, function(err, votes) { postData.votes = votes; callback(err, { From e738d592dcd08deac5f54285514c120185b43b84 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Wed, 10 Sep 2014 16:10:53 -0400 Subject: [PATCH 2/3] fixed potential NaN issue https://github.com/NodeBB/NodeBB/issues/2077 --- src/favourites.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/favourites.js b/src/favourites.js index 663bfec5f8..ae55417f5e 100644 --- a/src/favourites.js +++ b/src/favourites.js @@ -44,7 +44,7 @@ var async = require('async'), db.sortedSetAdd('users:reputation', newreputation, postData.uid); - if (parseInt(meta.config['autoban:downvote'], 10) !== 0 && newreputation < parseInt(meta.config['autoban:downvote:threshold'], 10)) { + if (parseInt(meta.config['autoban:downvote'], 10) === 1 && newreputation < parseInt(meta.config['autoban:downvote:threshold'], 10)) { var adminUser = require('./socket.io/admin/user'); adminUser.banUser(postData.uid, function() { require('winston').info('uid ' + uid + ' was banned for reaching ' + newreputation + ' reputation'); From e34ef71acd547f133697778b049fe4075a428560 Mon Sep 17 00:00:00 2001 From: barisusakli Date: Fri, 12 Sep 2014 19:07:01 -0400 Subject: [PATCH 3/3] fixed resetLockout --- src/user/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/user/auth.js b/src/user/auth.js index 0aaa6f658a..594e7e843e 100644 --- a/src/user/auth.js +++ b/src/user/auth.js @@ -46,7 +46,7 @@ module.exports = function(User) { User.auth.resetLockout = function(uid, callback) { async.parallel([ - async.apply(db.delete, 'loginAttemps:' + uid), + async.apply(db.delete, 'loginAttempts:' + uid), async.apply(db.delete, 'lockout:' + uid) ], callback); }