Merge pull request #129 from resin-io/issue_#73

Add email address to the returned information, when using whoami(). Fix #73.
This commit is contained in:
Juan Cruz Viotti 2015-08-03 16:14:47 -04:00
commit b515e427ff
2 changed files with 16 additions and 3 deletions

View File

@ -1,5 +1,5 @@
(function() {
var TOKEN_URL, _, async, form, open, resin, settings, url;
var TOKEN_URL, _, async, form, open, resin, settings, url, visuals;
open = require('open');
@ -15,6 +15,8 @@
form = require('resin-cli-form');
visuals = require('resin-cli-visuals');
TOKEN_URL = url.resolve(settings.get('dashboardUrl'), '/preferences');
exports.login = {
@ -140,7 +142,12 @@
if (username == null) {
throw new Error('Username not found');
}
return console.log(username);
return resin.auth.getEmail().then(function(email) {
return console.log(visuals.table.vertical({
username: username,
email: email
}, ['$account information$', 'username', 'email']));
});
}).nodeify(done);
}
};

View File

@ -5,6 +5,7 @@ async = require('async')
resin = require('resin-sdk')
settings = require('resin-settings-client')
form = require('resin-cli-form')
visuals = require('resin-cli-visuals')
TOKEN_URL = url.resolve(settings.get('dashboardUrl'), '/preferences')
@ -177,5 +178,10 @@ exports.whoami =
resin.auth.whoami().then (username) ->
if not username?
throw new Error('Username not found')
console.log(username)
resin.auth.getEmail().then (email) ->
console.log visuals.table.vertical { username, email }, [
'$account information$'
'username'
'email'
]
.nodeify(done)