Skip to content

Commit c9a49f8

Browse files
authored
Merge pull request #1426 from donaldguy/patch-1
Don't ignore Db-level authSource on log-in
2 parents dbd7d68 + 0f86135 commit c9a49f8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/db.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,9 +1450,10 @@ var authenticate = function(self, username, password, options, callback) {
14501450

14511451
// the default db to authenticate against is 'self'
14521452
// if authententicate is called from a retry context, it may be another one, like admin
1453-
var authdb = options.authdb ? options.authdb : options.dbName;
1453+
var authdb = options.dbName ? options.dbName : self.databaseName;
1454+
authdb = self.authSource ? self.authSource : authdb;
1455+
authdb = options.authdb ? options.authdb : authdb;
14541456
authdb = options.authSource ? options.authSource : authdb;
1455-
authdb = authdb ? authdb : self.databaseName;
14561457

14571458
// Callback
14581459
var _callback = function(err, result) {

0 commit comments

Comments
 (0)