function authorizedUser(req, res, next) {
	if (req.user === undefined || req.session.user === null) {
		req.flash('error', 'You need to be authenticated to view this page');
		res.status(403).redirect('/login');
	} else next();
}
// Check if user is logged in, if not redirect to /login page
Check if user is logged in, if not redirect to /login page
Check if user is logged in if not redirect to / login page
function authorizedUser(req, res, next) {
	if (req.user === undefined || req.session.user === null) {
		req.flash('error', 'You need to be authenticated to view this page');
		res.status(403).redirect('/login');
	} else next();
}
function authorizedUser ( req , res , next ) { if ( req . user === undefined || req . session . user === null ) { req . flash ( 'error' , 'You need to be authenticated to view this page' ) ; res . status ( 403 ) . redirect ( '/login' ) ; } else next ( ) ; }
Check if user is logged in, if not redirect to /login page
Check if user is logged in if not redirect to / login page