Skip to content

Node.js based forum software built for the modern web

fix: handle undefined returnTo on registerAbort

gasovedac1b9692f2bc
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index f45cce94fc..b2ca8e056e 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -220,7 +220,7 @@ authenticationController.registerAbort = function (req, res) {
if (req.uid) {
// Clear interstitial data and continue on...
delete req.session.registration;
- res.redirect(nconf.get('relative_path') + req.session.returnTo);
+ res.redirect(nconf.get('relative_path') + (req.session.returnTo || '/'));
} else {
// End the session and redirect to home
req.session.destroy(() => {