Skip to content

Commit

Permalink
Merge pull request #6 from surr-name/authFix
Browse files Browse the repository at this point in the history
authentication does not work
  • Loading branch information
diversario committed Apr 8, 2014
2 parents ceb1490 + a403f51 commit fd05a96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/connect-mongostore.js
Expand Up @@ -78,7 +78,7 @@ function getStore(Store) {
if (err) throw new Error('Error connecting to database:\n' + err.message + '\n' + err.stack + '\n')

if (self.options.username && self.options.password) {
db.authenticate(self.options.username, self.options.password, function () {
db.admin().authenticate(self.options.username, self.options.password, function () {
self.getCollection(cb)
})
} else {
Expand Down Expand Up @@ -351,4 +351,4 @@ function dbFromMongooseConnection(mongooseConnection, opts) {

module.exports = function (connect) {
return getStore(connect.session.Store)
}
}
4 changes: 2 additions & 2 deletions test/connect-mongostore.test.js
Expand Up @@ -83,7 +83,7 @@ function dbFromMongooseConnection(mongooseConnection, opts) {
*/
function authenticate(db, options, cb) {
if (options.username && options.password) {
db.authenticate(options.username, options.password, cb)
db.admin().authenticate(options.username, options.password, cb)
} else cb()
}

Expand Down Expand Up @@ -611,4 +611,4 @@ describe('Connect-mongostore', function () {
})
})
})
})
})

0 comments on commit fd05a96

Please sign in to comment.