diff --git a/lib/ldapauth.js b/lib/ldapauth.js index b825fc0..e356a57 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,