mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-20 06:07:55 +00:00
Merge pull request #266 from resin-io/jviotti/feature/resin-url-info
Clarify resin url on auth and whoami
This commit is contained in:
commit
e42d3e8c4c
@ -34,19 +34,22 @@
|
||||
],
|
||||
primary: true,
|
||||
action: function(params, options, done) {
|
||||
return form.run([
|
||||
{
|
||||
message: 'Email:',
|
||||
name: 'email',
|
||||
type: 'input',
|
||||
validate: validation.validateEmail
|
||||
}, {
|
||||
message: 'Password:',
|
||||
name: 'password',
|
||||
type: 'password'
|
||||
}
|
||||
], {
|
||||
override: options
|
||||
return resin.settings.get('resinUrl').then(function(resinUrl) {
|
||||
console.log("Logging in to " + resinUrl);
|
||||
return form.run([
|
||||
{
|
||||
message: 'Email:',
|
||||
name: 'email',
|
||||
type: 'input',
|
||||
validate: validation.validateEmail
|
||||
}, {
|
||||
message: 'Password:',
|
||||
name: 'password',
|
||||
type: 'password'
|
||||
}
|
||||
], {
|
||||
override: options
|
||||
});
|
||||
}).then(resin.auth.login).then(resin.auth.twoFactor.isPassed).then(function(isTwoFactorAuthPassed) {
|
||||
if (isTwoFactorAuthPassed) {
|
||||
return;
|
||||
@ -114,9 +117,10 @@
|
||||
action: function(params, options, done) {
|
||||
return Promise.props({
|
||||
username: resin.auth.whoami(),
|
||||
email: resin.auth.getEmail()
|
||||
email: resin.auth.getEmail(),
|
||||
url: resin.settings.get('resinUrl')
|
||||
}).then(function(results) {
|
||||
return console.log(visuals.table.vertical(results, ['$account information$', 'username', 'email']));
|
||||
return console.log(visuals.table.vertical(results, ['$account information$', 'username', 'email', 'url']));
|
||||
}).nodeify(done);
|
||||
}
|
||||
};
|
||||
|
@ -32,17 +32,21 @@ exports.login =
|
||||
]
|
||||
primary: true
|
||||
action: (params, options, done) ->
|
||||
form.run [
|
||||
message: 'Email:'
|
||||
name: 'email'
|
||||
type: 'input'
|
||||
validate: validation.validateEmail
|
||||
,
|
||||
message: 'Password:'
|
||||
name: 'password'
|
||||
type: 'password'
|
||||
],
|
||||
override: options
|
||||
resin.settings.get('resinUrl')
|
||||
.then (resinUrl) ->
|
||||
console.log("Logging in to #{resinUrl}")
|
||||
|
||||
return form.run [
|
||||
message: 'Email:'
|
||||
name: 'email'
|
||||
type: 'input'
|
||||
validate: validation.validateEmail
|
||||
,
|
||||
message: 'Password:'
|
||||
name: 'password'
|
||||
type: 'password'
|
||||
],
|
||||
override: options
|
||||
.then(resin.auth.login)
|
||||
.then(resin.auth.twoFactor.isPassed)
|
||||
.then (isTwoFactorAuthPassed) ->
|
||||
@ -133,10 +137,12 @@ exports.whoami =
|
||||
Promise.props
|
||||
username: resin.auth.whoami()
|
||||
email: resin.auth.getEmail()
|
||||
url: resin.settings.get('resinUrl')
|
||||
.then (results) ->
|
||||
console.log visuals.table.vertical results, [
|
||||
'$account information$'
|
||||
'username'
|
||||
'email'
|
||||
'url'
|
||||
]
|
||||
.nodeify(done)
|
||||
|
Loading…
Reference in New Issue
Block a user