diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-02-03 13:16:00 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-02-03 13:16:00 -0500 |
| commit | 0a5ab97ceb3a9f77666f0595eeddb74d0624000e (patch) | |
| tree | 4324fedee1d4120006858ae71fd003e24ac7ef20 | |
| parent | f51b018fd760d8550a06cb900a1311164ea881ad (diff) | |
| parent | 78620c1451f78bdb470ed89c8a1e5c7a6bb10990 (diff) | |
Merge branch 'subscriptions' of github.com:okfocus/vvalls into subscriptions
| -rw-r--r-- | config.json.example | 3 | ||||
| -rw-r--r-- | server/index.js | 1 | ||||
| -rw-r--r-- | server/lib/auth/index.js | 9 |
3 files changed, 11 insertions, 2 deletions
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, |
