From bcd00dc02d270486adafe6dbf973a4ec25499a5e Mon Sep 17 00:00:00 2001 From: Tyler Henkel Date: Fri, 4 Jul 2014 12:53:39 -0600 Subject: [PATCH] fix(server): only enable sessions if twitter oauth was selected --- app/templates/server/config/express.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/templates/server/config/express.js b/app/templates/server/config/express.js index e882bd5cd..1ef0eccb7 100644 --- a/app/templates/server/config/express.js +++ b/app/templates/server/config/express.js @@ -14,7 +14,7 @@ var cookieParser = require('cookie-parser'); var errorHandler = require('errorhandler'); var path = require('path'); var config = require('./environment');<% if (filters.auth) { %> -var passport = require('passport'); +var passport = require('passport');<% } %><% if (filters.twitterAuth) { %> var session = require('express-session'); var mongoStore = require('connect-mongo')(session);<% } %> @@ -29,9 +29,10 @@ module.exports = function(app) { app.use(bodyParser()); app.use(methodOverride()); app.use(cookieParser()); - <% if (filters.auth) { %>app.use(passport.initialize());<% } %><% if (filters.auth) { %> + <% if (filters.auth) { %>app.use(passport.initialize());<% } %><% if (filters.twitterAuth) { %> // Persist sessions with mongoStore + // We need to enable sessions for passport twitter because its an oauth 1.0 strategy app.use(session({ secret: config.secrets.session, store: new mongoStore({