$70 GRAYBYTE WORDPRESS FILE MANAGER $25

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib/

HOME
Current File : /opt/alt/alt-nodejs6/root/usr/lib/node_modules/npm/lib//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)
  })
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
1 Jan 1970 8.00 AM
root / root
0
cache
--
31 Aug 2024 8.02 AM
root / root
0755
config
--
31 Aug 2024 8.02 AM
root / root
0755
install
--
31 Aug 2024 8.02 AM
root / root
0755
utils
--
31 Aug 2024 8.02 AM
root / root
0755
access.js
3.234 KB
28 Sep 2021 4.36 PM
root / root
0644
adduser.js
3.983 KB
28 Sep 2021 4.36 PM
root / root
0644
bin.js
0.503 KB
28 Sep 2021 4.36 PM
root / root
0644
bugs.js
0.837 KB
28 Sep 2021 4.36 PM
root / root
0644
build.js
8.503 KB
28 Sep 2021 4.36 PM
root / root
0644
cache.js
10.167 KB
28 Sep 2021 4.36 PM
root / root
0644
completion.js
7.064 KB
28 Sep 2021 4.36 PM
root / root
0644
config.js
8.271 KB
28 Sep 2021 4.36 PM
root / root
0644
dedupe.js
5.271 KB
28 Sep 2021 4.36 PM
root / root
0644
deprecate.js
1.396 KB
28 Sep 2021 4.36 PM
root / root
0644
dist-tag.js
3.665 KB
28 Sep 2021 4.36 PM
root / root
0644
docs.js
1.033 KB
28 Sep 2021 4.36 PM
root / root
0644
edit.js
0.962 KB
28 Sep 2021 4.36 PM
root / root
0644
explore.js
1.629 KB
28 Sep 2021 4.36 PM
root / root
0644
fetch-package-metadata.js
11.499 KB
28 Sep 2021 4.36 PM
root / root
0644
fetch-package-metadata.md
1.765 KB
28 Sep 2021 4.36 PM
root / root
0644
get.js
0.229 KB
28 Sep 2021 4.36 PM
root / root
0644
help-search.js
5.65 KB
28 Sep 2021 4.36 PM
root / root
0644
help.js
6.187 KB
28 Sep 2021 4.36 PM
root / root
0644
init.js
1.268 KB
28 Sep 2021 4.36 PM
root / root
0644
install-test.js
0.495 KB
28 Sep 2021 4.36 PM
root / root
0644
install.js
25.485 KB
28 Sep 2021 4.36 PM
root / root
0644
link.js
5.547 KB
28 Sep 2021 4.36 PM
root / root
0644
logout.js
1.096 KB
28 Sep 2021 4.36 PM
root / root
0644
ls.js
13.939 KB
28 Sep 2021 4.36 PM
root / root
0644
npm.js
11.229 KB
28 Sep 2021 4.36 PM
root / root
0644
outdated.js
12.099 KB
28 Sep 2021 4.36 PM
root / root
0644
owner.js
7.547 KB
28 Sep 2021 4.36 PM
root / root
0644
pack.js
1.789 KB
28 Sep 2021 4.36 PM
root / root
0644
ping.js
0.543 KB
28 Sep 2021 4.36 PM
root / root
0644
prefix.js
0.322 KB
28 Sep 2021 4.36 PM
root / root
0644
prune.js
1.496 KB
28 Sep 2021 4.36 PM
root / root
0644
publish.js
5.016 KB
28 Sep 2021 4.36 PM
root / root
0644
rebuild.js
2.109 KB
28 Sep 2021 4.36 PM
root / root
0644
repo.js
1.43 KB
28 Sep 2021 4.36 PM
root / root
0644
restart.js
0.063 KB
28 Sep 2021 4.36 PM
root / root
0644
root.js
0.309 KB
28 Sep 2021 4.36 PM
root / root
0644
run-script.js
5.163 KB
28 Sep 2021 4.36 PM
root / root
0644
search.js
7.758 KB
28 Sep 2021 4.36 PM
root / root
0644
set.js
0.27 KB
28 Sep 2021 4.36 PM
root / root
0644
shrinkwrap.js
6.541 KB
28 Sep 2021 4.36 PM
root / root
0644
star.js
1.174 KB
28 Sep 2021 4.36 PM
root / root
0644
stars.js
1.097 KB
28 Sep 2021 4.36 PM
root / root
0644
start.js
0.061 KB
28 Sep 2021 4.36 PM
root / root
0644
stop.js
0.06 KB
28 Sep 2021 4.36 PM
root / root
0644
substack.js
0.497 KB
28 Sep 2021 4.36 PM
root / root
0644
tag.js
1.085 KB
28 Sep 2021 4.36 PM
root / root
0644
team.js
1.405 KB
28 Sep 2021 4.36 PM
root / root
0644
test.js
0.287 KB
28 Sep 2021 4.36 PM
root / root
0644
unbuild.js
3.966 KB
28 Sep 2021 4.36 PM
root / root
0644
uninstall.js
2.307 KB
28 Sep 2021 4.36 PM
root / root
0644
unpublish.js
3.551 KB
28 Sep 2021 4.36 PM
root / root
0644
update.js
1.757 KB
28 Sep 2021 4.36 PM
root / root
0644
version.js
7.708 KB
28 Sep 2021 4.36 PM
root / root
0644
view.js
9.12 KB
28 Sep 2021 4.36 PM
root / root
0644
visnup.js
4.008 KB
28 Sep 2021 4.36 PM
root / root
0644
whoami.js
1.421 KB
28 Sep 2021 4.36 PM
root / root
0644
xmas.js
1.571 KB
28 Sep 2021 4.36 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF