|
|
@ -10,7 +10,7 @@ var pagination = require('../../pagination');
|
|
|
|
var events = require('../../events');
|
|
|
|
var events = require('../../events');
|
|
|
|
var plugins = require('../../plugins');
|
|
|
|
var plugins = require('../../plugins');
|
|
|
|
|
|
|
|
|
|
|
|
var usersController = {};
|
|
|
|
var usersController = module.exports;
|
|
|
|
|
|
|
|
|
|
|
|
var userFields = ['uid', 'username', 'userslug', 'email', 'postcount', 'joindate', 'banned',
|
|
|
|
var userFields = ['uid', 'username', 'userslug', 'email', 'postcount', 'joindate', 'banned',
|
|
|
|
'reputation', 'picture', 'flags', 'lastonline', 'email:confirmed'];
|
|
|
|
'reputation', 'picture', 'flags', 'lastonline', 'email:confirmed'];
|
|
|
@ -63,6 +63,8 @@ usersController.registrationQueue = function (req, res, next) {
|
|
|
|
var stop = start + itemsPerPage - 1;
|
|
|
|
var stop = start + itemsPerPage - 1;
|
|
|
|
var invitations;
|
|
|
|
var invitations;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
|
|
|
|
function (next) {
|
|
|
|
async.parallel({
|
|
|
|
async.parallel({
|
|
|
|
registrationQueueCount: function (next) {
|
|
|
|
registrationQueueCount: function (next) {
|
|
|
|
db.sortedSetCard('registration:queue', next);
|
|
|
|
db.sortedSetCard('registration:queue', next);
|
|
|
@ -105,15 +107,15 @@ usersController.registrationQueue = function (req, res, next) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
], next);
|
|
|
|
], next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, function (err, data) {
|
|
|
|
}, next);
|
|
|
|
if (err) {
|
|
|
|
},
|
|
|
|
return next(err);
|
|
|
|
function (data) {
|
|
|
|
}
|
|
|
|
|
|
|
|
var pageCount = Math.max(1, Math.ceil(data.registrationQueueCount / itemsPerPage));
|
|
|
|
var pageCount = Math.max(1, Math.ceil(data.registrationQueueCount / itemsPerPage));
|
|
|
|
data.pagination = pagination.create(page, pageCount);
|
|
|
|
data.pagination = pagination.create(page, pageCount);
|
|
|
|
data.customHeaders = data.customHeaders.headers;
|
|
|
|
data.customHeaders = data.customHeaders.headers;
|
|
|
|
res.render('admin/manage/registration', data);
|
|
|
|
res.render('admin/manage/registration', data);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
], next);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
function getUsers(set, section, min, max, req, res, next) {
|
|
|
|
function getUsers(set, section, min, max, req, res, next) {
|
|
|
@ -123,6 +125,8 @@ function getUsers(set, section, min, max, req, res, next) {
|
|
|
|
var stop = start + resultsPerPage - 1;
|
|
|
|
var stop = start + resultsPerPage - 1;
|
|
|
|
var byScore = min !== undefined && max !== undefined;
|
|
|
|
var byScore = min !== undefined && max !== undefined;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
|
|
|
|
function (next) {
|
|
|
|
async.parallel({
|
|
|
|
async.parallel({
|
|
|
|
count: function (next) {
|
|
|
|
count: function (next) {
|
|
|
|
if (byScore) {
|
|
|
|
if (byScore) {
|
|
|
@ -147,11 +151,9 @@ function getUsers(set, section, min, max, req, res, next) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
], next);
|
|
|
|
], next);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, function (err, results) {
|
|
|
|
}, next);
|
|
|
|
if (err) {
|
|
|
|
},
|
|
|
|
return next(err);
|
|
|
|
function (results) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
results.users = results.users.filter(function (user) {
|
|
|
|
results.users = results.users.filter(function (user) {
|
|
|
|
user.email = validator.escape(String(user.email || ''));
|
|
|
|
user.email = validator.escape(String(user.email || ''));
|
|
|
|
return user && parseInt(user.uid, 10);
|
|
|
|
return user && parseInt(user.uid, 10);
|
|
|
@ -163,7 +165,8 @@ function getUsers(set, section, min, max, req, res, next) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
data[section] = true;
|
|
|
|
data[section] = true;
|
|
|
|
render(req, res, data);
|
|
|
|
render(req, res, data);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
], next);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function render(req, res, data) {
|
|
|
|
function render(req, res, data) {
|
|
|
@ -185,15 +188,14 @@ usersController.getCSV = function (req, res, next) {
|
|
|
|
uid: req.user.uid,
|
|
|
|
uid: req.user.uid,
|
|
|
|
ip: req.ip,
|
|
|
|
ip: req.ip,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
async.waterfall([
|
|
|
|
user.getUsersCSV(function (err, data) {
|
|
|
|
function (next) {
|
|
|
|
if (err) {
|
|
|
|
user.getUsersCSV(next);
|
|
|
|
return next(err);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
function (data) {
|
|
|
|
res.attachment('users.csv');
|
|
|
|
res.attachment('users.csv');
|
|
|
|
res.setHeader('Content-Type', 'text/csv');
|
|
|
|
res.setHeader('Content-Type', 'text/csv');
|
|
|
|
res.end(data);
|
|
|
|
res.end(data);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
], next);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = usersController;
|
|
|
|
|
|
|
|