From c0796469731dd9e1751ebadbf8af7f7ac08965f4 Mon Sep 17 00:00:00 2001 From: Matthias Unterberger Date: Thu, 25 Sep 2014 12:03:21 +0200 Subject: [PATCH 1/2] Check pattern for username I wrote the pattern differently and this would have saved me a few hours --- lib/ldapauth.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ldapauth.js b/lib/ldapauth.js index b825fc0..cb51658 100644 --- a/lib/ldapauth.js +++ b/lib/ldapauth.js @@ -283,6 +283,10 @@ LdapAuth.prototype._findUser = function (username, callback) { return callback(new Error("LDAP connection is not yet bound")); } + if(!self.opts.searchFilter.indexOf('{{username}}') === -1){ + return callback(new Error("missing pattern for username in searchFilter")); + } + var searchFilter = self.opts.searchFilter.replace('{{username}}', username); var opts = { filter: searchFilter, From d2cb1a34deb650f9994a19f29e6f768264d7c866 Mon Sep 17 00:00:00 2001 From: Matthias Unterberger Date: Thu, 25 Sep 2014 12:07:22 +0200 Subject: [PATCH 2/2] Update ldapauth.js --- lib/ldapauth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ldapauth.js b/lib/ldapauth.js index cb51658..e356a57 100644 --- a/lib/ldapauth.js +++ b/lib/ldapauth.js @@ -283,7 +283,7 @@ LdapAuth.prototype._findUser = function (username, callback) { return callback(new Error("LDAP connection is not yet bound")); } - if(!self.opts.searchFilter.indexOf('{{username}}') === -1){ + if(self.opts.searchFilter.indexOf('{{username}}') === -1){ return callback(new Error("missing pattern for username in searchFilter")); }