diff --git a/src/routes/authentication.js b/src/routes/authentication.js index fc5444e1cd..979e08c1bc 100644 --- a/src/routes/authentication.js +++ b/src/routes/authentication.js @@ -132,12 +132,11 @@ user.notifications.sendWelcomeNotification(uid); - plugins.fireHook('filter:register.complete', uid, req.body.referrer, function(err, uid, destination) { - if (destination) { - res.redirect(nconf.get('relative_path') + destination); - } else { - res.redirect(nconf.get('relative_path') + '/'); + plugins.fireHook('filter:register.complete', {uid: uid, referrer: req.body.referrer}, function(err, data) { + if (err) { + return res.redirect(nconf.get('relative_path') + '/register'); } + res.redirect(nconf.get('relative_path') + (data.referrer ? data.referrer : '/')); }); }); });