Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-09-30 00:26:07 +0300
committerRebecca Turner <me@re-becca.org>2017-10-04 11:08:26 +0300
commitf644018e6ef1ff7523c6ec60ae55a24e87a9d9ae (patch)
tree9ebd6aeecb3cb2b5c1e63f0215d2e2ac7e23fd50
parentf97ad6a38412581d059108ea29be470acb4fa510 (diff)
map-to-registry: Generally add support for otp flag
-rw-r--r--doc/cli/npm-access.md3
-rw-r--r--doc/cli/npm-dist-tag.md4
-rw-r--r--doc/cli/npm-owner.md4
-rw-r--r--lib/utils/map-to-registry.js3
4 files changed, 13 insertions, 1 deletions
diff --git a/doc/cli/npm-access.md b/doc/cli/npm-access.md
index aabdbe03c..a338673c8 100644
--- a/doc/cli/npm-access.md
+++ b/doc/cli/npm-access.md
@@ -60,6 +60,9 @@ You must have privileges to set the access of a package:
* You have been given read-write privileges for a package, either as a member
of a team or directly as an owner.
+If you have two-factor authentication enabled then you'll have to pass in an
+otp with `--otp` when making access changes.
+
If your account is not paid, then attempts to publish scoped packages will fail
with an HTTP 402 status code (logically enough), unless you use
`--access=public`.
diff --git a/doc/cli/npm-dist-tag.md b/doc/cli/npm-dist-tag.md
index 8b4c170dd..14ce2d3f5 100644
--- a/doc/cli/npm-dist-tag.md
+++ b/doc/cli/npm-dist-tag.md
@@ -15,7 +15,9 @@ Add, remove, and enumerate distribution tags on a package:
* add:
Tags the specified version of the package with the specified tag, or the
- `--tag` config if not specified.
+ `--tag` config if not specified. The tag you're adding is `latest` and you
+ have two-factor authentication on auth-and-writes then you'll need to include
+ an otp on the command line with `--otp`.
* rm:
Clear a tag that is no longer in use from the package.
diff --git a/doc/cli/npm-owner.md b/doc/cli/npm-owner.md
index 43929cb33..94010298c 100644
--- a/doc/cli/npm-owner.md
+++ b/doc/cli/npm-owner.md
@@ -27,6 +27,10 @@ Note that there is only one level of access. Either you can modify a package,
or you can't. Future versions may contain more fine-grained access levels, but
that is not implemented at this time.
+If you have two-factor authentication enabled with `auth-and-writes` then
+you'll need to include an otp on the command line when changing ownership
+with `--otp`.
+
## SEE ALSO
* npm-publish(1)
diff --git a/lib/utils/map-to-registry.js b/lib/utils/map-to-registry.js
index 1f9798c09..d6e0a5b01 100644
--- a/lib/utils/map-to-registry.js
+++ b/lib/utils/map-to-registry.js
@@ -2,6 +2,7 @@ var url = require('url')
var log = require('npmlog')
var npa = require('npm-package-arg')
+var config
module.exports = mapToRegistry
@@ -94,6 +95,8 @@ function scopeAuth (uri, registry, auth) {
} else {
log.silly('scopeAuth', uri, "doesn't share host with registry", registry)
}
+ if (!config) config = require('../npm').config
+ if (config.get('otp')) cleaned.otp = config.get('otp')
}
return cleaned