mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-08 16:05:05 -04:00
allows for multiple user logins along with live config file reading
This commit is contained in:
parent
cba2c1f83a
commit
d02643575e
2 changed files with 11 additions and 2 deletions
|
@ -24,8 +24,12 @@ exports.basicAuth = function (req, res, next) {
|
||||||
// If a password has been set and auth headers are present...
|
// If a password has been set and auth headers are present...
|
||||||
if (pass && req.headers.authorization && req.headers.authorization.search('Basic ') === 0) {
|
if (pass && req.headers.authorization && req.headers.authorization.search('Basic ') === 0) {
|
||||||
// ...check login and password
|
// ...check login and password
|
||||||
if (new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString() === pass) {
|
var userLogin = new Buffer(req.headers.authorization.split(' ')[1], 'base64').toString();
|
||||||
return next();
|
settings.readConfig();
|
||||||
|
for (var loginIndex in pass) {
|
||||||
|
if (userLogin === pass[loginIndex]) {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Do not require auth for static paths...this could be a bit brittle
|
// Do not require auth for static paths...this could be a bit brittle
|
||||||
|
|
|
@ -103,6 +103,8 @@ exports.abiwordAvailable = function()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.readConfig = function()
|
||||||
|
{
|
||||||
// Discover where the settings file lives
|
// Discover where the settings file lives
|
||||||
var settingsFilename = argv.settings || "settings.json";
|
var settingsFilename = argv.settings || "settings.json";
|
||||||
if (settingsFilename.charAt(0) != '/') {
|
if (settingsFilename.charAt(0) != '/') {
|
||||||
|
@ -149,3 +151,6 @@ for(var i in settings)
|
||||||
console.warn("This setting doesn't exist or it was removed");
|
console.warn("This setting doesn't exist or it was removed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.readConfig();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue