Allow plugins to affect whether a registration goes into the queue

v1.18.x
Ben Lubar 8 years ago
parent ffb020826a
commit 2161f0d473
No known key found for this signature in database
GPG Key ID: 018BAB45DB2D2B24

@ -56,25 +56,30 @@ authenticationController.register = function (req, res, next) {
user.isPasswordValid(userData.password, next);
},
function (next) {
res.locals.processLogin = true; // set it to false in plugin if you wish to just register only
plugins.fireHook('filter:register.check', {req: req, res: res, userData: userData}, next);
},
function (data, next) {
if (registrationType === 'normal' || registrationType === 'invite-only' || registrationType === 'admin-invite-only') {
registerAndLoginUser(req, res, userData, next);
next(null, false);
} else if (registrationType === 'admin-approval') {
addToApprovalQueue(req, userData, next);
next(null, true);
} else if (registrationType === 'admin-approval-ip') {
db.sortedSetCard('ip:' + req.ip + ':uid', function (err, count) {
if (err) {
next(err);
} else if (count) {
addToApprovalQueue(req, userData, next);
} else {
registerAndLoginUser(req, res, userData, next);
next(null, !!count);
}
});
}
},
function (queue, next) {
res.locals.processLogin = true; // set it to false in plugin if you wish to just register only
plugins.fireHook('filter:register.check', {req: req, res: res, userData: userData, queue: queue}, next);
},
function (data, next) {
if (data.queue) {
addToApprovalQueue(req, userData, next);
} else {
registerAndLoginUser(req, res, userData, next);
}
}
], function (err, data) {
if (err) {

Loading…
Cancel
Save