mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 02:25:55 +01:00
closes #6435
This commit is contained in:
@@ -152,7 +152,12 @@ authenticationController.registerComplete = function (req, res, next) {
|
||||
|
||||
var callbacks = data.interstitials.reduce(function (memo, cur) {
|
||||
if (cur.hasOwnProperty('callback') && typeof cur.callback === 'function') {
|
||||
memo.push(async.apply(cur.callback, req.session.registration, req.body));
|
||||
memo.push(function (next) {
|
||||
cur.callback(req.session.registration, req.body, function (err) {
|
||||
// Pass error as second argument so all callbacks are executed
|
||||
next(null, err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return memo;
|
||||
@@ -170,9 +175,11 @@ authenticationController.registerComplete = function (req, res, next) {
|
||||
}
|
||||
};
|
||||
|
||||
async.parallel(callbacks, function (err) {
|
||||
if (err) {
|
||||
req.flash('error', err.message);
|
||||
async.parallel(callbacks, function (_blank, err) {
|
||||
if (err.length) {
|
||||
req.flash('errors', err.filter(Boolean).map(function (err) {
|
||||
return err.message;
|
||||
}));
|
||||
return res.redirect(nconf.get('relative_path') + '/register/complete');
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ Controllers.registerInterstitial = function (req, res, next) {
|
||||
async.parallel(renders, next);
|
||||
},
|
||||
function (sections) {
|
||||
var errors = req.flash('error');
|
||||
var errors = req.flash('errors');
|
||||
res.render('registerComplete', {
|
||||
title: '[[pages:registration-complete]]',
|
||||
errors: errors,
|
||||
|
||||
Reference in New Issue
Block a user