| 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 | |
| 366 | module.exports = Profile |