MCPcopy Index your code
hub / github.com/nodejs/node / disable2fa

Method disable2fa

deps/npm/lib/commands/profile.js:342–363  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

340 }
341
342 async disable2fa () {
343 const opts = { ...this.npm.flatOptions }
344 const info = await get(opts)
345
346 if (!info.tfa || info.tfa.pending) {
347 output.standard('Two factor authentication not enabled.')
348 return
349 }
350
351 const password = await readUserInfo.password()
352
353 log.info('profile', 'disabling tfa')
354 await otplease(this.npm, opts, o => set({ tfa: { password: password, mode: 'disable' } }, o))
355
356 if (this.npm.config.get('json')) {
357 output.buffer({ tfa: false })
358 } else if (this.npm.config.get('parseable')) {
359 output.standard('tfa\tfalse')
360 } else {
361 output.standard('Two factor authentication disabled.')
362 }
363 }
364}
365
366module.exports = Profile

Callers 1

execMethod · 0.95

Calls 7

otpleaseFunction · 0.85
passwordMethod · 0.80
infoMethod · 0.80
getMethod · 0.65
getFunction · 0.50
setFunction · 0.50
bufferMethod · 0.45

Tested by

no test coverage detected