Node.js based forum software built for the modern web
fix: don't crash if session doesn't exist
Barış Soner Uşaklı3717df610acb
diff --git a/src/routes/authentication.js b/src/routes/authentication.jsindex b8373296cf..ca7b98d870 100644--- a/src/routes/authentication.js+++ b/src/routes/authentication.js@@ -131,12 +131,16 @@ Auth.reloadRoutes = async function (params) {passport.authenticate(strategy.name, (err, user) => {if (err) {- delete req.session.registration;+ if (req.session && req.session.registration) {+ delete req.session.registration;+ }return next(err);}if (!user) {- delete req.session.registration;+ if (req.session && req.session.registration) {+ delete req.session.registration;+ }return helpers.redirect(res, strategy.failureUrl !== undefined ? strategy.failureUrl : '/login');}