diff --git a/lib/utils/otplease.js b/lib/utils/otplease.js index 8bfe7da1d387f..44f9aaa89b7a3 100644 --- a/lib/utils/otplease.js +++ b/lib/utils/otplease.js @@ -6,8 +6,8 @@ async function otplease (npm, opts, fn) { throw err } - const isBackwardsCompatibleOTP = err.code === 'E401' && /one-time pass/.test(err.body) - const isClassicOTP = err.code === 'EOTP' + const isClassicOTP = + err.code === 'EOTP' || (err.code === 'E401' && /one-time pass/.test(err.body)) const isWebOTP = err.code === 'EOTP' && err.body?.authUrl && err.body?.doneUrl if (isWebOTP) { @@ -26,7 +26,7 @@ async function otplease (npm, opts, fn) { return await fn({ ...opts, otp }) } - if (isClassicOTP || isBackwardsCompatibleOTP) { + if (isClassicOTP) { const readUserInfo = require('./read-user-info.js') const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:') return await fn({ ...opts, otp })