Skip to content

Commit

Permalink
address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory committed Mar 11, 2019
1 parent 428f156 commit f19a2d8
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions bin/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@ const minimist = require('minimist'),
default: { 'source': process.cwd() }
});
},
tokenCodeFn = function (mfaSerial, callback) {
tokenCodeFn = function (code) {
'use strict';
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
return function (mfaSerial, callback) {

readline.question(`Please enter the code for MFA device ${mfaSerial}:`, (code) => {
readline.close();
callback(null, code);
});
if (code) {
return callback(null, String(code));
}
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});

readline.question(`Please enter the code for MFA device ${mfaSerial}:`, (value) => {
readline.close();
return callback(null, String(value));
});

};
},
main = function () {
'use strict';
Expand Down Expand Up @@ -76,7 +83,7 @@ const minimist = require('minimist'),
SerialNumber,
DurationSeconds: process.env.AWS_MFA_DURATION || args['mfa-duration'] || 3600
});
Object.assign(TemporaryCredentialsParams, {tokenCodeFn});
Object.assign(TemporaryCredentialsParams, {tokenCodeFn: tokenCodeFn(args['mfa-token'])});
}

if (RoleArn) {
Expand Down

0 comments on commit f19a2d8

Please sign in to comment.