Fix account shpw command when PLATFORMIO_AUTH_TOKEN is used

This commit is contained in:
Ivan Kravets
2020-06-04 14:09:42 +03:00
parent 3c1b08daab
commit 0c4c113b0a

View File

@@ -167,15 +167,13 @@ class AccountClient(RESTClient): # pylint:disable=too-many-public-methods
return response return response
def get_account_info(self, offline=False): def get_account_info(self, offline=False):
account = app.get_state_item("account") account = app.get_state_item("account") or {}
if not account:
raise AccountNotAuthorized()
if ( if (
account.get("summary") account.get("summary")
and account["summary"].get("expire_at", 0) > time.time() and account["summary"].get("expire_at", 0) > time.time()
): ):
return account["summary"] return account["summary"]
if offline: if offline and account.get("email"):
return { return {
"profile": { "profile": {
"email": account.get("email"), "email": account.get("email"),