Skip to content
Snippets Groups Projects
Commit 9da5fcc2 authored by michael.minelli's avatar michael.minelli
Browse files

LoginCommand => Wait for the password to be entered before doing the request

parent 2ad019c7
No related branches found
No related tags found
No related merge requests found
Pipeline #25043 passed
......@@ -27,7 +27,8 @@ class CommanderApp {
.description('Login into the application')
.requiredOption('-u, --user <string>', '[Required] Username to use when connecting to server.')
.option('-p, --password <string>', 'Password to use when connecting to server. If password is not given it\'s asked.')
.action((options) => {
.action(async (options) => {
const passwordPromise = new Promise((resolve, reject) => {
if ( !options.password ) {
prompt.get({
properties: {
......@@ -39,8 +40,14 @@ class CommanderApp {
}
}, (err, result) => {
options.password = result.password;
resolve(undefined);
});
} else {
resolve(undefined);
}
});
await passwordPromise;
SessionManager.login(options.user, options.password);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment