summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-02-03 13:07:42 -0500
committerJules Laplace <jules@okfoc.us>2015-02-03 13:07:42 -0500
commit78620c1451f78bdb470ed89c8a1e5c7a6bb10990 (patch)
tree39fde553a7b781779db032279c3a9ff322fe1aaa /server
parent1169b347c1f339b64f30466004a3f9a06ef7e117 (diff)
support basicAuth
Diffstat (limited to 'server')
-rw-r--r--server/index.js1
-rw-r--r--server/lib/auth/index.js9
2 files changed, 9 insertions, 1 deletions
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,