From 14e290c489f8d9cc281c3e4b1348cd3dc8524e15 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 9 Mar 2017 22:28:14 -0500 Subject: [PATCH] org key fixes --- src/app/global/sideNavController.js | 2 +- src/app/services/cryptoService.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/global/sideNavController.js b/src/app/global/sideNavController.js index 9243f6eb87..20953dd382 100644 --- a/src/app/global/sideNavController.js +++ b/src/app/global/sideNavController.js @@ -7,7 +7,7 @@ angular if ($state.includes('backend.org')) { var userProfile = authService.getUserProfile(); - if (!userProfile.organizations.length) { + if (!userProfile.organizations || !userProfile.organizations.length) { return; } diff --git a/src/app/services/cryptoService.js b/src/app/services/cryptoService.js index fbc5d07c01..9aa60febf2 100644 --- a/src/app/services/cryptoService.js +++ b/src/app/services/cryptoService.js @@ -115,13 +115,20 @@ angular } if ($sessionStorage.orgKeys) { - _orgKeys = {}; + var orgKeys = {}, + setKey = false; + for (var orgId in $sessionStorage.orgKeys) { if ($sessionStorage.orgKeys.hasOwnProperty(orgId)) { var orgKeyBytes = forge.util.decode64($sessionStorage.orgKeys[orgId]); - _orgKeys[orgId] = orgKeyBytes; + orgKeys[orgId] = orgKeyBytes; + setKey = true; } } + + if (setKey) { + _orgKeys = orgKeys; + } } return _orgKeys;