From 220c82a8f24faca3f61f2716441916c41fcd07ed Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sat, 8 Nov 2014 15:01:56 -0500 Subject: [PATCH] filter:register.complete change #1527 --- src/routes/authentication.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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 : '/')); }); }); });