Merge pull request #266 from resin-io/jviotti/feature/resin-url-info

Clarify resin url on auth and whoami
This commit is contained in:
Juan Cruz Viotti 2015-11-18 16:15:46 -04:00
commit e42d3e8c4c
2 changed files with 36 additions and 26 deletions

View File

@ -34,6 +34,8 @@
], ],
primary: true, primary: true,
action: function(params, options, done) { action: function(params, options, done) {
return resin.settings.get('resinUrl').then(function(resinUrl) {
console.log("Logging in to " + resinUrl);
return form.run([ return form.run([
{ {
message: 'Email:', message: 'Email:',
@ -47,6 +49,7 @@
} }
], { ], {
override: options override: options
});
}).then(resin.auth.login).then(resin.auth.twoFactor.isPassed).then(function(isTwoFactorAuthPassed) { }).then(resin.auth.login).then(resin.auth.twoFactor.isPassed).then(function(isTwoFactorAuthPassed) {
if (isTwoFactorAuthPassed) { if (isTwoFactorAuthPassed) {
return; return;
@ -114,9 +117,10 @@
action: function(params, options, done) { action: function(params, options, done) {
return Promise.props({ return Promise.props({
username: resin.auth.whoami(), username: resin.auth.whoami(),
email: resin.auth.getEmail() email: resin.auth.getEmail(),
url: resin.settings.get('resinUrl')
}).then(function(results) { }).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); }).nodeify(done);
} }
}; };

View File

@ -32,7 +32,11 @@ exports.login =
] ]
primary: true primary: true
action: (params, options, done) -> action: (params, options, done) ->
form.run [ resin.settings.get('resinUrl')
.then (resinUrl) ->
console.log("Logging in to #{resinUrl}")
return form.run [
message: 'Email:' message: 'Email:'
name: 'email' name: 'email'
type: 'input' type: 'input'
@ -133,10 +137,12 @@ exports.whoami =
Promise.props Promise.props
username: resin.auth.whoami() username: resin.auth.whoami()
email: resin.auth.getEmail() email: resin.auth.getEmail()
url: resin.settings.get('resinUrl')
.then (results) -> .then (results) ->
console.log visuals.table.vertical results, [ console.log visuals.table.vertical results, [
'$account information$' '$account information$'
'username' 'username'
'email' 'email'
'url'
] ]
.nodeify(done) .nodeify(done)