vesse / passport-ldapauth

LDAP authentication strategy for Passport
MIT License
312 stars 100 forks source link

"options.userNotFound" does not work #89

Open wakabayashik opened 5 years ago

wakabayashik commented 5 years ago

it seems that the option userNotFound for passport.authenticate() does not work.

https://github.com/vesse/passport-ldapauth/blob/0467cc3613461cba7952ead352b59a6ac5de5845/lib/passport-ldapauth/strategy.js#L283-L284

I think above line should become like this;

      if (typeof err === 'string' && err.match(/no such user/i)) {
        var message = options.userNotFound || options.invalidCredentials || 'Invalid username/password';
        return this.fail({ message: message }, 401);
      }
      if (err.name === 'InvalidCredentialsError' || err.name === 'NoSuchObjectError') {
        var message; 
        ...