Permalink
Browse files

Use this.conf.get('username'), not this.username

Root cause of npm/npm#2731
  • Loading branch information...
1 parent cea541e commit 80bd9a8e91133f302086f0c6ac924cd96a9a77e4 @isaacs isaacs committed Aug 19, 2012
Showing with 6 additions and 4 deletions.
  1. +3 −1 lib/request.js
  2. +3 −3 lib/star.js
View
@@ -73,9 +73,11 @@ function regRequest (method, where, what, etag, nofollow, cb_) {
if (couch && !token) {
// login to get a valid token
- var a = { name: this.username, password: this.password }
+ var a = { name: this.conf.get('username'),
+ password: this.conf.get('_password') }
var args = arguments
return this.couchLogin.login(a, function (er, cr, data) {
+ console.error('logged in?', a)
if (er || !couch.valid(couch.token)) {
er = er || new Error('login error')
return cb(er, cr, data)
View
@@ -2,7 +2,7 @@
module.exports = star
function star (package, starred, cb) {
- if (!this.username) return cb(new Error(
+ if (!this.conf.get('username')) return cb(new Error(
"Must be logged in to star/unstar packages"))
var users = {}
@@ -16,10 +16,10 @@ function star (package, starred, cb) {
if (starred) {
this.log.info("starring", fullData._id)
- fullData.users[this.username] = true
+ fullData.users[this.conf.get('username')] = true
this.log.verbose("starring", fullData)
} else {
- delete fullData.users[this.username]
+ delete fullData.users[this.conf.get('username')]
this.log.info("unstarring", fullData._id)
this.log.verbose("unstarring", fullData)
}

0 comments on commit 80bd9a8

Please sign in to comment.