Skip to content

Node.js based forum software built for the modern web

closes #6435

Julian Lame9ed7f0bb355
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index 88d0ec5b49..f8537da085 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -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');
}
diff --git a/src/controllers/index.js b/src/controllers/index.js
index 550130ce92..292d892767 100644
--- a/src/controllers/index.js
+++ b/src/controllers/index.js
@@ -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,