summaryrefslogtreecommitdiff
path: root/deps/npm/lib/profile.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/profile.js')
-rw-r--r--deps/npm/lib/profile.js28
1 files changed, 6 insertions, 22 deletions
diff --git a/deps/npm/lib/profile.js b/deps/npm/lib/profile.js
index 016e898157..587a26ca8b 100644
--- a/deps/npm/lib/profile.js
+++ b/deps/npm/lib/profile.js
@@ -82,18 +82,7 @@ function config () {
registry: npm.config.get('registry'),
otp: npm.config.get('otp')
}
- const creds = npm.config.getCredentialsByURI(conf.registry)
- if (creds.token) {
- conf.auth = {token: creds.token}
- } else if (creds.username) {
- conf.auth = {basic: {username: creds.username, password: creds.password}}
- } else if (creds.auth) {
- const auth = Buffer.from(creds.auth, 'base64').toString().split(':', 2)
- conf.auth = {basic: {username: auth[0], password: auth[1]}}
- } else {
- conf.auth = {}
- }
-
+ conf.auth = npm.config.getCredentialsByURI(conf.registry)
if (conf.otp) conf.auth.otp = conf.otp
return conf
}
@@ -166,17 +155,12 @@ function set (args) {
return Promise.reject(Error(`"${prop}" is not a property we can set. Valid properties are: ` + writableProfileKeys.join(', ')))
}
return Bluebird.try(() => {
- if (prop === 'password') {
- return readUserInfo.password('Current password: ').then((current) => {
- return readPasswords().then((newpassword) => {
- value = {old: current, new: newpassword}
- })
+ if (prop !== 'password') return
+ return readUserInfo.password('Current password: ').then((current) => {
+ return readPasswords().then((newpassword) => {
+ value = {old: current, new: newpassword}
})
- } else if (prop === 'email') {
- return readUserInfo.password('Password: ').then((current) => {
- return {password: current, email: value}
- })
- }
+ })
function readPasswords () {
return readUserInfo.password('New password: ').then((password1) => {
return readUserInfo.password(' Again: ').then((password2) => {