REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.91 KB
Close
/proc/thread-self/root/proc/thread-self/root/opt/alt/alt-nodejs9/root/lib/node_modules/npm/lib/auth/legacy.js
Text
Base64
'use strict' const read = require('../utils/read-user-info.js') const profile = require('npm-profile') const log = require('npmlog') const npm = require('../npm.js') const output = require('../utils/output.js') const pacoteOpts = require('../config/pacote') const fetchOpts = require('../config/fetch-opts') module.exports.login = function login (creds, registry, scope, cb) { let username = creds.username || '' let password = creds.password || '' let email = creds.email || '' const auth = {} if (npm.config.get('otp')) auth.otp = npm.config.get('otp') return read.username('Username:', username, {log: log}).then((u) => { username = u return read.password('Password: ', password) }).then((p) => { password = p return read.email('Email: (this IS public) ', email, {log: log}) }).then((e) => { email = e return profile.login(username, password, {registry: registry, auth: auth}).catch((err) => { if (err.code === 'EOTP') throw err return profile.adduser(username, email, password, { registry: registry, opts: fetchOpts.fromPacote(pacoteOpts()) }) }).catch((err) => { if (err.code === 'EOTP' && !auth.otp) { return read.otp('Authenticator provided OTP:').then((otp) => { auth.otp = otp return profile.login(username, password, {registry: registry, auth: auth}) }) } else { throw err } }) }).then((result) => { const newCreds = {} if (result && result.token) { newCreds.token = result.token } else { newCreds.username = username newCreds.password = password newCreds.email = email newCreds.alwaysAuth = npm.config.get('always-auth') } log.info('adduser', 'Authorized user %s', username) const scopeMessage = scope ? ' to scope ' + scope : '' output('Logged in as %s%s on %s.', username, scopeMessage, registry) cb(null, newCreds) }).catch(cb) }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
legacy.js
1.91 KB
lrw-r--r--
2021-09-28 11:28:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
oauth.js
182 B
lrw-r--r--
2021-09-28 11:28:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
saml.js
181 B
lrw-r--r--
2021-09-28 11:28:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
sso.js
1.83 KB
lrw-r--r--
2021-09-28 11:28:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).