????JFIF??x?x????'403WebShell
403Webshell
Server IP : 79.136.114.73  /  Your IP : 3.137.185.239
Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f
System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64
User : www-data ( 33)
PHP Version : 5.5.9-1ubuntu4.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/lib/node_modules/npm/lib/auth/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lib/node_modules/npm/lib/auth/legacy.js
const log = require('npmlog')
const profile = require('npm-profile')

const openUrl = require('../utils/open-url.js')
const read = require('../utils/read-user-info.js')

const loginPrompter = async (creds) => {
  const opts = { log: log }

  creds.username = await read.username('Username:', creds.username, opts)
  creds.password = await read.password('Password:', creds.password)
  creds.email = await read.email('Email: (this IS public) ', creds.email, opts)

  return creds
}

const login = async (npm, opts) => {
  let res

  const requestOTP = async () => {
    const otp = await read.otp(
      'Enter one-time password from your authenticator app: '
    )

    return profile.loginCouch(
      opts.creds.username,
      opts.creds.password,
      { ...opts, otp }
    )
  }

  const addNewUser = async () => {
    let newUser

    try {
      newUser = await profile.adduserCouch(
        opts.creds.username,
        opts.creds.email,
        opts.creds.password,
        opts
      )
    } catch (err) {
      if (err.code === 'EOTP')
        newUser = await requestOTP()
      else
        throw err
    }

    return newUser
  }

  const openerPromise = (url) => openUrl(npm, url, 'to complete your login please visit')
  try {
    res = await profile.login(openerPromise, loginPrompter, opts)
  } catch (err) {
    const needsMoreInfo = !(opts &&
      opts.creds &&
      opts.creds.username &&
      opts.creds.password &&
      opts.creds.email)
    if (err.code === 'EOTP')
      res = await requestOTP()
    else if (needsMoreInfo)
      throw err
    else {
      // TODO: maybe this needs to check for err.code === 'E400' instead?
      res = await addNewUser()
    }
  }

  const newCreds = {}
  if (res && res.token)
    newCreds.token = res.token
  else {
    newCreds.username = opts.creds.username
    newCreds.password = opts.creds.password
    newCreds.email = opts.creds.email
    newCreds.alwaysAuth = opts.creds.alwaysAuth
  }

  const usermsg = opts.creds.username ? ` user ${opts.creds.username}` : ''
  const scopeMessage = opts.scope ? ` to scope ${opts.scope}` : ''
  const userout = opts.creds.username ? ` as ${opts.creds.username}` : ''
  const message = `Logged in${userout}${scopeMessage} on ${opts.registry}.`

  log.info('login', `Authorized${usermsg}`)

  return {
    message,
    newCreds,
  }
}

module.exports = login

Youez - 2016 - github.com/yon3zu
LinuXploit