From d08c86d68ceb22665b735054fc3bc316f85f84c1 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sat, 31 Jan 2015 08:51:55 -0500 Subject: billing link in footer --- server/lib/auth/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/lib/auth/index.js') diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index a9a2400..199377d 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -135,12 +135,12 @@ var auth = { deserializeUser: function (id, done) { try { var _id = mongoose.Types.ObjectId(id) - User.findOne({ _id: _id }, "_id displayName username photo isStaff", function (err, user) { + User.findOne({ _id: _id }, "_id displayName username photo isStaff plan_level", function (err, user) { done(err, user); }); } catch (e) { - User.findOne({ twitter_id: id }, "_id displayName username photo isStaff", function (err, user) { + User.findOne({ twitter_id: id }, "_id displayName username photo isStaff plan_level", function (err, user) { done(err, user); }); } -- cgit v1.2.3-70-g09d2 From 78620c1451f78bdb470ed89c8a1e5c7a6bb10990 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 3 Feb 2015 13:07:42 -0500 Subject: support basicAuth --- config.json.example | 3 ++- server/index.js | 1 + server/lib/auth/index.js | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'server/lib/auth/index.js') diff --git a/config.json.example b/config.json.example index 7072d48..7221aa0 100644 --- a/config.json.example +++ b/config.json.example @@ -5,5 +5,6 @@ "socketPort": 1337, "webhookPort": 5000, "databaseHost": "lvh.me", - "env": { "development": 1 } + "env": { "development": 1 }, + "basicAuth": { "user": "foo", "pass": "bar" } } diff --git a/server/index.js b/server/index.js index 8c8212f..7bc3f7f 100644 --- a/server/index.js +++ b/server/index.js @@ -39,6 +39,7 @@ site.ready = function(){ site.setup = function(){ var SessionStore = new MongoStore({ mongoose_connection: mongoose.connection }) + auth.initBasicAuth(app) app.set('port', config.port); app.set('views', path.join(__dirname, '../views')); app.set('view engine', 'ejs'); diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index 199377d..8e20bcc 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -39,7 +39,14 @@ var auth = { auth.mail.init() }, - + initBasicAuth: function(app){ + if (config.basicAuth) { + app.use(express.basicAuth(function(user, pass) { + return user === config.basicAuth.user && + pass === config.basicAuth.pass + })) + } + }, initSockets: function (io, SessionStore) { io.set('authorization', passportSocketIo.authorize({ cookieParser: express.cookieParser, -- cgit v1.2.3-70-g09d2 From 98b641551cf1af355ed7816fb7e861625ffa8f1e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 25 Jan 2016 20:23:18 +0100 Subject: fb --- server/lib/auth/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/lib/auth/index.js') diff --git a/server/lib/auth/index.js b/server/lib/auth/index.js index 8e20bcc..46bff21 100644 --- a/server/lib/auth/index.js +++ b/server/lib/auth/index.js @@ -247,7 +247,7 @@ var auth = { facebookUrl: profile.username ? "https://facebook.com/" + profile.username : "" }; - User.findOne({twitter_id: profile.id}, function(err, data){ + User.findOne({facebook_id: profile.id}, function(err, data){ if (! err && data) { return done(err, data); } -- cgit v1.2.3-70-g09d2