mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 16:00:26 +01:00
new hooks to customize registration queue with custom data
This commit is contained in:
@@ -6,7 +6,7 @@ var meta = require('../../meta');
|
|||||||
var db = require('../../database');
|
var db = require('../../database');
|
||||||
var pagination = require('../../pagination');
|
var pagination = require('../../pagination');
|
||||||
var events = require('../../events');
|
var events = require('../../events');
|
||||||
|
var plugins = require('../../plugins');
|
||||||
|
|
||||||
var usersController = {};
|
var usersController = {};
|
||||||
|
|
||||||
@@ -87,6 +87,7 @@ usersController.registrationQueue = function(req, res, next) {
|
|||||||
var start = (page - 1) * 20;
|
var start = (page - 1) * 20;
|
||||||
var stop = start + itemsPerPage - 1;
|
var stop = start + itemsPerPage - 1;
|
||||||
var invitations;
|
var invitations;
|
||||||
|
|
||||||
async.parallel({
|
async.parallel({
|
||||||
registrationQueueCount: function(next) {
|
registrationQueueCount: function(next) {
|
||||||
db.sortedSetCard('registration:queue', next);
|
db.sortedSetCard('registration:queue', next);
|
||||||
@@ -94,6 +95,9 @@ usersController.registrationQueue = function(req, res, next) {
|
|||||||
users: function(next) {
|
users: function(next) {
|
||||||
user.getRegistrationQueue(start, stop, next);
|
user.getRegistrationQueue(start, stop, next);
|
||||||
},
|
},
|
||||||
|
customHeaders: function(next) {
|
||||||
|
plugins.fireHook('filter:admin.registrationQueue.customHeaders', {headers: []}, next);
|
||||||
|
},
|
||||||
invites: function(next) {
|
invites: function(next) {
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function(next) {
|
function(next) {
|
||||||
@@ -132,6 +136,7 @@ usersController.registrationQueue = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
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;
|
||||||
res.render('admin/manage/registration', data);
|
res.render('admin/manage/registration', data);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ var notifications = require('../notifications');
|
|||||||
var groups = require('../groups');
|
var groups = require('../groups');
|
||||||
var translator = require('../../public/src/modules/translator');
|
var translator = require('../../public/src/modules/translator');
|
||||||
var utils = require('../../public/src/utils');
|
var utils = require('../../public/src/utils');
|
||||||
|
var plugins = require('../plugins');
|
||||||
|
|
||||||
module.exports = function(User) {
|
module.exports = function(User) {
|
||||||
|
|
||||||
@@ -31,8 +31,10 @@ module.exports = function(User) {
|
|||||||
ip: userData.ip,
|
ip: userData.ip,
|
||||||
hashedPassword: hashedPassword
|
hashedPassword: hashedPassword
|
||||||
};
|
};
|
||||||
|
plugins.fireHook('filter:user.addToApprovalQueue', {data: data, userData: userData}, next);
|
||||||
db.setObject('registration:queue:name:' + userData.username, data, next);
|
},
|
||||||
|
function(results, next) {
|
||||||
|
db.setObject('registration:queue:name:' + userData.username, results.data, next);
|
||||||
},
|
},
|
||||||
function(next) {
|
function(next) {
|
||||||
db.sortedSetAdd('registration:queue', Date.now(), userData.username, next);
|
db.sortedSetAdd('registration:queue', Date.now(), userData.username, next);
|
||||||
@@ -206,6 +208,12 @@ module.exports = function(User) {
|
|||||||
next(err, user);
|
next(err, user);
|
||||||
});
|
});
|
||||||
}, next);
|
}, next);
|
||||||
|
},
|
||||||
|
function(users, next) {
|
||||||
|
plugins.fireHook('filter:user.getRegistrationQueue', {users: users}, next);
|
||||||
|
},
|
||||||
|
function(results, next) {
|
||||||
|
next(null, results.users);
|
||||||
}
|
}
|
||||||
], callback);
|
], callback);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
<th class="hidden-xs">IP</th>
|
<th class="hidden-xs">IP</th>
|
||||||
<th class="hidden-xs">Time</th>
|
<th class="hidden-xs">Time</th>
|
||||||
|
<!-- BEGIN customHeaders -->
|
||||||
|
<th class="hidden-xs">{customHeaders.label}</th>
|
||||||
|
<!-- END customHeaders -->
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- BEGIN users -->
|
<!-- BEGIN users -->
|
||||||
@@ -55,6 +58,11 @@
|
|||||||
<td class="hidden-xs">
|
<td class="hidden-xs">
|
||||||
<span class="timeago" title="{users.timestampISO}"></span>
|
<span class="timeago" title="{users.timestampISO}"></span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<!-- BEGIN users.customRows -->
|
||||||
|
<td class="hidden-xs">{users.customRows.value}</td>
|
||||||
|
<!-- END users.customRows -->
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group pull-right">
|
<div class="btn-group pull-right">
|
||||||
<button class="btn btn-success btn-xs" data-action="accept"><i class="fa fa-check"></i></button>
|
<button class="btn btn-success btn-xs" data-action="accept"><i class="fa fa-check"></i></button>
|
||||||
|
|||||||
Reference in New Issue
Block a user