]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/commitdiff
Make listen port and ldap filter more flexible master
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 4 May 2020 23:19:03 +0000 (01:19 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 5 May 2020 00:17:44 +0000 (02:17 +0200)
server.js
src/auth.js

index c17fcb8c180e8ef6b04d8cafad3b6b8cb577199b..e79dad29e444f652477bba8fe20af6e94afac793 100755 (executable)
--- 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;
 
index 5f4c7776601ceb0cbcd4117212c22c3ee8160382..d575d601d1c91c0a84ed3202e37cb30b87c6c66c 100644 (file)
@@ -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 = [];