Add email address to the returned information, when using whoami(). Fix #73.

This commit is contained in:
mike 2015-07-30 14:48:03 +03:00
parent e2125b8ce9
commit f31eb7c2b5
2 changed files with 13 additions and 8 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 = {
@ -141,10 +143,10 @@
throw new Error('Username not found');
}
return resin.auth.getEmail().then(function(email) {
if (email == null) {
throw new Error('Email not found');
}
return console.log(("Username: " + username) + '\n' + ("Email: " + 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')
@ -178,7 +179,9 @@ exports.whoami =
if not username?
throw new Error('Username not found')
resin.auth.getEmail().then (email) ->
if not email?
throw new Error('Email not found')
console.log "Username: #{username}" + '\n' + "Email: #{email}"
console.log visuals.table.vertical { username, email }, [
'$account information$'
'username'
'email'
]
.nodeify(done)