diff --git a/src/server/auth.js b/src/server/auth.js index a017edb5..56d6efc1 100644 --- a/src/server/auth.js +++ b/src/server/auth.js @@ -4,18 +4,17 @@ var settings = require('./settings'), if (settings.read('authentication')) { var [name, pwd] = settings.read('authentication').split(':'), - httpAuth = require("http-auth") + httpAuth = require('http-auth') - - auth = httpAuth.basic( - { - realm: "Open Stage Control" - }, - (username, password, callback) => { - // Custom authentication method. - callback(username === name && password === pwd); - } - ) + auth = httpAuth.basic( + { + realm: 'Open Stage Control' + }, + (username, password, callback) => { + // Custom authentication method. + callback(username === name && password === pwd) + } + ) } diff --git a/src/server/ipc/server.js b/src/server/ipc/server.js index 53c8619e..9be982df 100644 --- a/src/server/ipc/server.js +++ b/src/server/ipc/server.js @@ -17,8 +17,8 @@ class Ipc extends EventEmitter { this.server.on('connection', (socket, req)=>{ if (settings.read('authentication')) { - if (!req.headers.authorization) return; - if (req.headers.authorization.search('Basic ') !== 0) return; + if (!req.headers.authorization) return + if (req.headers.authorization.search('Basic ') !== 0) return var auth = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString() if (settings.read('authentication') !== auth) { console.log(`(WARNING) Client connexion refused for ${req.connection.remoteAddress} (authentication failed)`)