Node.js based forum software built for the modern web
fix: if user is logged in after registration don't go back to /login
Barış Soner Uşaklı23b37f6227b9
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.jsindex 299bfa571b..007d3ba6ac 100644--- a/src/controllers/authentication.js+++ b/src/controllers/authentication.js@@ -64,7 +64,10 @@ async function registerAndLoginUser(req, res, userData) {]);}await user.deleteInvitationKey(userData.email, userData.token);- const next = req.session.returnTo || `${nconf.get('relative_path')}/`;+ let next = req.session.returnTo || `${nconf.get('relative_path')}/`;+ if (req.loggedIn && next === `${nconf.get('relative_path')}/login`) {+ next = `${nconf.get('relative_path')}/`;+ }const complete = await plugins.hooks.fire('filter:register.complete', { uid: uid, next: next });req.session.returnTo = complete.next;return complete;