Skip to content

Commit

Permalink
refactor: simplify boolean variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jumoel committed Jun 29, 2022
1 parent aa0ab58 commit 1298d8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/utils/otplease.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 })
Expand Down

0 comments on commit 1298d8e

Please sign in to comment.