fix login

This commit is contained in:
reality 2014-09-04 14:41:57 +00:00
parent 78057dca3c
commit c519727b6c

View File

@ -4,11 +4,11 @@ var express = require('express'),
flash = require('connect-flash'), flash = require('connect-flash'),
_ = require('underscore')._, _ = require('underscore')._,
fs = require('fs'), fs = require('fs'),
LocalStrategy = require('passport-local').Strategy, cookieParser = require('cookie-parser'),
cookieParser = require('cookie-parser'); bodyParser = require('body-parser'),
bodyParser = require('body-parser'); expressSession = require('express-session'),
expressSession = require('express-session'); methodOverride = require('method-override'),
methodOverride = require('method-override'); LocalStrategy = require('passport-local').Strategy;
var webInterface = function(dbot) { var webInterface = function(dbot) {
this.config = dbot.config.modules.web; this.config = dbot.config.modules.web;
@ -19,9 +19,10 @@ var webInterface = function(dbot) {
this.app.use(express.static(this.pub)); this.app.use(express.static(this.pub));
this.app.set('view engine', 'jade'); this.app.set('view engine', 'jade');
this.app.use(cookieParser()); this.app.use(cookieParser());
this.app.use(bodyParser.json());
this.app.use(bodyParser.urlencoded({ 'extended': true }));
this.app.use(methodOverride()); this.app.use(methodOverride());
this.app.use(expressSession({ 'secret': 'wat' })); this.app.use(expressSession({ 'secret': 'wat' }));
this.app.use(bodyParser());
this.app.use(flash()); this.app.use(flash());
this.app.use(passport.initialize()); this.app.use(passport.initialize());
@ -32,7 +33,7 @@ var webInterface = function(dbot) {
}); });
passport.deserializeUser(function(id, done) { passport.deserializeUser(function(id, done) {
dbot.api.users.getUser(id, function(user) { dbot.api.users.getUser(id, function(err, user) {
done(null, user); done(null, user);
}); });
}); });