fix: #8050, fix redirect after registration

v1.18.x
Baris Usakli 5 years ago
parent 0002c3f499
commit 366ad5cd69

@ -34,6 +34,9 @@ async function registerAndLoginUser(req, res, userData) {
userData.register = true; userData.register = true;
req.session.registration = userData; req.session.registration = userData;
if (req.body.referrer) {
req.session.referrer = req.body.referrer;
}
if (req.body.noscript === 'true') { if (req.body.noscript === 'true') {
res.redirect(nconf.get('relative_path') + '/register/complete'); res.redirect(nconf.get('relative_path') + '/register/complete');
return; return;
@ -53,7 +56,10 @@ async function registerAndLoginUser(req, res, userData) {
} }
user.deleteInvitationKey(userData.email); user.deleteInvitationKey(userData.email);
return await plugins.fireHook('filter:register.complete', { uid: uid, referrer: req.body.referrer || nconf.get('relative_path') + '/' }); const referrer = req.body.referrer || req.session.referrer || nconf.get('relative_path') + '/';
const complete = await plugins.fireHook('filter:register.complete', { uid: uid, referrer: referrer });
req.session.returnTo = complete.referrer;
return complete;
} }
const registerAndLoginUserCallback = util.callbackify(registerAndLoginUser); const registerAndLoginUserCallback = util.callbackify(registerAndLoginUser);

Loading…
Cancel
Save