diff options
author | Gar <gar+gh@danger.computer> | 2022-03-29 17:05:29 +0300 |
---|---|---|
committer | Luke Karrys <luke@lukekarrys.com> | 2022-03-30 00:53:35 +0300 |
commit | 8b65bfd5d610a70e1a860936be1a47f3a3df7f32 (patch) | |
tree | dae3ee97ed57a4eb7009ed8b0821de1380466b7f /lib | |
parent | aac01b89caf6336a2eb34d696296303cdadd5c08 (diff) |
fix: return otplease fn results
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/otplease.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/utils/otplease.js b/lib/utils/otplease.js index 566c24ef2..83985b6bc 100644 --- a/lib/utils/otplease.js +++ b/lib/utils/otplease.js @@ -1,17 +1,17 @@ -const readUserInfo = require('./read-user-info.js') - -module.exports = otplease async function otplease (opts, fn) { try { - await fn(opts) + return await fn(opts) } catch (err) { + const readUserInfo = require('./read-user-info.js') if (err.code !== 'EOTP' && (err.code !== 'E401' || !/one-time pass/.test(err.body))) { throw err } else if (!process.stdin.isTTY || !process.stdout.isTTY) { throw err } else { const otp = await readUserInfo.otp('This operation requires a one-time password.\nEnter OTP:') - return fn({ ...opts, otp }) + return await fn({ ...opts, otp }) } } } + +module.exports = otplease |