diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2015-01-23 06:56:30 -0800 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-23 23:19:27 +0100 |
commit | f5b35dbda45c466eda888a4451591c66e8671faf (patch) | |
tree | fe89dd3e105a3693bd0776c678813dadae21065d /deps/npm/lib/whoami.js | |
parent | f3fed5193caaac151acd555a7523068ee269801c (diff) | |
download | android-node-v8-f5b35dbda45c466eda888a4451591c66e8671faf.tar.gz android-node-v8-f5b35dbda45c466eda888a4451591c66e8671faf.tar.bz2 android-node-v8-f5b35dbda45c466eda888a4451591c66e8671faf.zip |
deps: upgrade npm to 2.3.0
* Windows improvements: no more uid is undefined errors, use `%COMSPEC%`
when set in preference to hardcoded `cmd`, improved handling of Git
remotes.
* Add caching based on Last-Modified / If-Modified-Since headers in
addition to Etag-based cache validation.
PR-URL: https://github.com/iojs/io.js/pull/573
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/npm/lib/whoami.js')
-rw-r--r-- | deps/npm/lib/whoami.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/deps/npm/lib/whoami.js b/deps/npm/lib/whoami.js index 121c4336ae..42cede1b82 100644 --- a/deps/npm/lib/whoami.js +++ b/deps/npm/lib/whoami.js @@ -14,6 +14,14 @@ function whoami (args, silent, cb) { var registry = npm.config.get("registry") if (!registry) return cb(new Error("no default registry set")) + function noUser () { + // At this point, if they have a credentials object, it doesn't have a + // token or auth in it. Probably just the default registry. + var msg = "Not authed. Run 'npm adduser'" + if (!silent) console.log(msg) + cb(null, msg) + } + var auth = npm.config.getCredentialsByURI(registry) if (auth) { if (auth.username) { @@ -23,6 +31,7 @@ function whoami (args, silent, cb) { else if (auth.token) { return npm.registry.whoami(registry, { auth : auth }, function (er, username) { if (er) return cb(er) + if (!username) return noUser() if (!silent) console.log(username) cb(null, username) @@ -30,10 +39,5 @@ function whoami (args, silent, cb) { } } - // At this point, if they have a credentials object, it doesn't - // have a token or auth in it. Probably just the default - // registry. - var msg = "Not authed. Run 'npm adduser'" - if (!silent) console.log(msg) - process.nextTick(cb.bind(this, null, msg)) + process.nextTick(noUser) } |