mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 03:27:01 +02:00
feat: update unban logic/invocation and refactor User.bans module
* auto unban when User.getUsersFields is called and the user is banned but has expired * cleanups and removal of expiry_readable * expiry_readable make an alias for backward compatibility * User.bans.func vs User.*ban*Func * console.log cleanups, plus todo message added * use code util.deprecate * fix: remove ununsed winston require
This commit is contained in:
@@ -446,7 +446,7 @@ authenticationController.localLogin = function (req, username, password, next) {
|
||||
user.isAdminOrGlobalMod(uid, next);
|
||||
},
|
||||
banned: function (next) {
|
||||
user.isBanned(uid, next);
|
||||
user.bans.isBanned(uid, next);
|
||||
},
|
||||
hasLoginPrivilege: function (next) {
|
||||
privileges.global.can('local:login', uid, next);
|
||||
@@ -551,7 +551,7 @@ function getBanInfo(uid, callback) {
|
||||
});
|
||||
},
|
||||
function (next) {
|
||||
next(new Error(banInfo.expiry ? '[[error:user-banned-reason-until, ' + banInfo.expiry_readable + ', ' + banInfo.reason + ']]' : '[[error:user-banned-reason, ' + banInfo.reason + ']]'));
|
||||
next(new Error(banInfo.banned_until ? '[[error:user-banned-reason-until, ' + banInfo.banned_until_readable + ', ' + banInfo.reason + ']]' : '[[error:user-banned-reason, ' + banInfo.reason + ']]'));
|
||||
},
|
||||
], function (err) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user