Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions middleware/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ module.exports = function(app) {

var session = require('express-session');
var MySQLStore = require('express-mysql-session')(session);
var sessionStore = new MySQLStore(app.config.db);

app.sessionStore = new MySQLStore(app.config.db);

app.use(session({
key: app.config.session.key,
secret: app.config.session.secret,
store: sessionStore,
store: app.sessionStore,
resave: false,
saveUninitialized: true
}));
Expand Down
11 changes: 10 additions & 1 deletion test/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var bcrypt = require('bcrypt-nodejs');
var app = require('../index');
var db = app.db;


var manager = module.exports = {

// Wait for the app to be ready.
Expand Down Expand Up @@ -40,7 +41,10 @@ var manager = module.exports = {

tearDown: function(cb) {

manager.dropDatabaseTables(cb);
async.series([
manager.dropDatabaseTables,
manager.clearSessions
], cb)
},

dropDatabaseTables: function(cb) {
Expand Down Expand Up @@ -72,5 +76,10 @@ var manager = module.exports = {
.catch(cb);
});
});
},

clearSessions: function(cb) {
app.sessionStore.clear();
cb();
}
};