mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-15 03:42:23 +01:00
Changed some bad comments referencing the Articles module in other modules.
Typo fixed in xxx.client.modules.js files ("Application" => "Applicaion")
Full stop character removed at the end of line comments
38 lines
861 B
JavaScript
38 lines
861 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Module dependencies
|
|
*/
|
|
var passport = require('passport'),
|
|
User = require('mongoose').model('User'),
|
|
path = require('path'),
|
|
config = require(path.resolve('./config/config'));
|
|
|
|
/**
|
|
* Module init function
|
|
*/
|
|
module.exports = function (app, db) {
|
|
// Serialize sessions
|
|
passport.serializeUser(function (user, done) {
|
|
done(null, user.id);
|
|
});
|
|
|
|
// Deserialize sessions
|
|
passport.deserializeUser(function (id, done) {
|
|
User.findOne({
|
|
_id: id
|
|
}, '-salt -password', function (err, user) {
|
|
done(err, user);
|
|
});
|
|
});
|
|
|
|
// Initialize strategies
|
|
config.utils.getGlobbedPaths(path.join(__dirname, './strategies/**/*.js')).forEach(function (strategy) {
|
|
require(path.resolve(strategy))(config);
|
|
});
|
|
|
|
// Add passport's middleware
|
|
app.use(passport.initialize());
|
|
app.use(passport.session());
|
|
};
|