From 476177380452c9c7c5b1624805feedc824c5995e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 5 May 2020 01:19:03 +0200 Subject: Make listen port and ldap filter more flexible --- server.js | 2 +- src/auth.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index c17fcb8..e79dad2 100755 --- a/server.js +++ b/server.js @@ -161,7 +161,7 @@ app.use('/', function (req, res) { }); app.use(lastMile()); -var server = app.listen(3000, function () { +var server = app.listen(process.env.LISTEN, function () { var host = server.address().address; var port = server.address().port; diff --git a/src/auth.js b/src/auth.js index 5f4c777..d575d60 100644 --- a/src/auth.js +++ b/src/auth.js @@ -71,8 +71,8 @@ function verifyUser(username, password, callback) { ldapClient.bind(process.env.CLOUDRON_LDAP_BIND_DN, process.env.CLOUDRON_LDAP_BIND_PASSWORD, function (error) { if (error) return callback(error); - var filter = `(|(uid=${username})(mail=${username})(username=${username})(sAMAccountName=${username}))`; - ldapClient.search(process.env.CLOUDRON_LDAP_USERS_BASE_DN, { filter: filter }, function (error, result) { + var filter = process.env.CLOUDRON_LDAP_FILTER.replace(/\{username\}/g, username); + ldapClient.search(process.env.CLOUDRON_LDAP_USERS_BASE_DN, { filter: filter, scope: "sub" }, function (error, result) { if (error) return callback(error); var items = []; -- cgit v1.2.3