X7ROOT File Manager
Current Path:
/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib
opt
/
alt
/
alt-nodejs6
/
root
/
usr
/
lib
/
node_modules
/
npm
/
lib
/
??
..
??
access.js
(3.23 KB)
??
adduser.js
(3.98 KB)
??
bin.js
(515 B)
??
bugs.js
(857 B)
??
build.js
(8.5 KB)
??
cache
??
cache.js
(10.17 KB)
??
completion.js
(7.06 KB)
??
config
??
config.js
(8.27 KB)
??
dedupe.js
(5.27 KB)
??
deprecate.js
(1.4 KB)
??
dist-tag.js
(3.67 KB)
??
docs.js
(1.03 KB)
??
edit.js
(985 B)
??
explore.js
(1.63 KB)
??
fetch-package-metadata.js
(11.5 KB)
??
fetch-package-metadata.md
(1.76 KB)
??
get.js
(235 B)
??
help-search.js
(5.65 KB)
??
help.js
(6.19 KB)
??
init.js
(1.27 KB)
??
install
??
install-test.js
(507 B)
??
install.js
(25.49 KB)
??
link.js
(5.55 KB)
??
logout.js
(1.1 KB)
??
ls.js
(13.94 KB)
??
npm.js
(11.23 KB)
??
outdated.js
(12.1 KB)
??
owner.js
(7.55 KB)
??
pack.js
(1.79 KB)
??
ping.js
(556 B)
??
prefix.js
(330 B)
??
prune.js
(1.5 KB)
??
publish.js
(5.02 KB)
??
rebuild.js
(2.11 KB)
??
repo.js
(1.43 KB)
??
restart.js
(64 B)
??
root.js
(316 B)
??
run-script.js
(5.16 KB)
??
search.js
(7.76 KB)
??
set.js
(276 B)
??
shrinkwrap.js
(6.54 KB)
??
star.js
(1.17 KB)
??
stars.js
(1.1 KB)
??
start.js
(62 B)
??
stop.js
(61 B)
??
substack.js
(509 B)
??
tag.js
(1.08 KB)
??
team.js
(1.41 KB)
??
test.js
(294 B)
??
unbuild.js
(3.97 KB)
??
uninstall.js
(2.31 KB)
??
unpublish.js
(3.55 KB)
??
update.js
(1.76 KB)
??
utils
??
version.js
(7.71 KB)
??
view.js
(9.12 KB)
??
visnup.js
(4.01 KB)
??
whoami.js
(1.42 KB)
??
xmas.js
(1.57 KB)
Editing: adduser.js
module.exports = adduser var log = require('npmlog') var npm = require('./npm.js') var read = require('read') var userValidate = require('npm-user-validate') var output = require('./utils/output') var usage = require('./utils/usage') var chain = require('slide').chain var crypto try { crypto = require('crypto') } catch (ex) {} adduser.usage = usage( 'adduser', 'npm adduser [--registry=url] [--scope=@orgname] [--always-auth]' ) function adduser (args, cb) { if (!crypto) { return cb(new Error( 'You must compile node with ssl support to use the adduser feature' )) } var creds = npm.config.getCredentialsByURI(npm.config.get('registry')) var c = { u: creds.username || '', p: creds.password || '', e: creds.email || '' } var u = {} log.disableProgress() chain([ [readUsername, c, u], [readPassword, c, u], [readEmail, c, u], [save, c, u] ], cb) } function readUsername (c, u, cb) { var v = userValidate.username read({prompt: 'Username: ', default: c.u || ''}, function (er, un) { if (er) { return cb(er.message === 'cancelled' ? er.message : er) } // make sure it's valid. we have to do this here, because // couchdb will only ever say "bad password" with a 401 when // you try to PUT a _users record that the validate_doc_update // rejects for *any* reason. if (!un) { return readUsername(c, u, cb) } var error = v(un) if (error) { log.warn(error.message) return readUsername(c, u, cb) } c.changed = c.u !== un u.u = un cb(er) }) } function readPassword (c, u, cb) { var v = userValidate.pw var prompt if (c.p && !c.changed) { prompt = 'Password: (or leave unchanged) ' } else { prompt = 'Password: ' } read({prompt: prompt, silent: true}, function (er, pw) { if (er) { return cb(er.message === 'cancelled' ? er.message : er) } if (!c.changed && pw === '') { // when the username was not changed, // empty response means "use the old value" pw = c.p } if (!pw) { return readPassword(c, u, cb) } var error = v(pw) if (error) { log.warn(error.message) return readPassword(c, u, cb) } c.changed = c.changed || c.p !== pw u.p = pw cb(er) }) } function readEmail (c, u, cb) { var v = userValidate.email var r = { prompt: 'Email: (this IS public) ', default: c.e || '' } read(r, function (er, em) { if (er) { return cb(er.message === 'cancelled' ? er.message : er) } if (!em) { return readEmail(c, u, cb) } var error = v(em) if (error) { log.warn(error.message) return readEmail(c, u, cb) } u.e = em cb(er) }) } function save (c, u, cb) { // save existing configs, but yank off for this PUT var uri = npm.config.get('registry') var scope = npm.config.get('scope') // there may be a saved scope and no --registry (for login) if (scope) { if (scope.charAt(0) !== '@') scope = '@' + scope var scopedRegistry = npm.config.get(scope + ':registry') var cliRegistry = npm.config.get('registry', 'cli') if (scopedRegistry && !cliRegistry) uri = scopedRegistry } var params = { auth: { username: u.u, password: u.p, email: u.e } } npm.registry.adduser(uri, params, function (er, doc) { if (er) return cb(er) // don't want this polluting the configuration npm.config.del('_token', 'user') if (scope) npm.config.set(scope + ':registry', uri, 'user') if (doc && doc.token) { npm.config.setCredentialsByURI(uri, { token: doc.token }) } else { npm.config.setCredentialsByURI(uri, { username: u.u, password: u.p, email: u.e, alwaysAuth: npm.config.get('always-auth') }) } log.info('adduser', 'Authorized user %s', u.u) var scopeMessage = scope ? ' to scope ' + scope : '' output('Logged in as %s%s on %s.', u.u, scopeMessage, uri) npm.config.save('user', cb) }) }
Upload File
Create Folder