diff --git a/src/app/services/authService.js b/src/app/services/authService.js index e9f2216cb6..5613aa9947 100644 --- a/src/app/services/authService.js +++ b/src/app/services/authService.js @@ -99,7 +99,8 @@ angular id: profile.Organizations[i].Id, name: profile.Organizations[i].Name, key: profile.Organizations[i].Key, - status: profile.Organizations[i].Status + status: profile.Organizations[i].Status, + type: profile.Organizations[i].Type }); } @@ -125,12 +126,13 @@ angular id: org.Id, name: org.Name, key: org.Key, - status: org.Status + status: 2, // 2 = Confirmed + type: 0 // 0 = Owner }; profile.organizations.push(o); _userProfile = profile; - cryptoService.addOrgKey(o); + cryptoService.addOrgKey(o.id, o.key); } }); }; diff --git a/src/app/services/cryptoService.js b/src/app/services/cryptoService.js index 60c73105c4..543d1930d2 100644 --- a/src/app/services/cryptoService.js +++ b/src/app/services/cryptoService.js @@ -53,7 +53,7 @@ angular } }; - _service.addOrgKey = function (orgKeyCt, privateKey) { + _service.addOrgKey = function (orgId, orgKey, privateKey) { _orgKeys = _service.getOrgKeys(); if (!_orgKeys) { _orgKeys = {}; @@ -65,9 +65,9 @@ angular } try { - var orgKey = _service.rsaDecrypt(orgKeyCt.key, privateKey); - _orgKeys[orgKeyCt.id] = orgKey; - orgKeysb64[orgKeyCt.id] = forge.util.encode64(orgKey); + var orgKey = _service.rsaDecrypt(orgKey, privateKey); + _orgKeys[orgId] = orgKey; + orgKeysb64[orgId] = forge.util.encode64(orgKey); } catch (e) { _orgKeys = null; diff --git a/src/app/settings/settingsController.js b/src/app/settings/settingsController.js index ea5cb0d03b..bbde1c3fb9 100644 --- a/src/app/settings/settingsController.js +++ b/src/app/settings/settingsController.js @@ -23,9 +23,16 @@ if (user.Organizations) { var orgs = []; for (var i = 0; i < user.Organizations.length; i++) { + // Only confirmed + if (user.Organizations[i].Status !== 2) { + continue; + } + orgs.push({ id: user.Organizations[i].Id, - name: user.Organizations[i].Name + name: user.Organizations[i].Name, + status: user.Organizations[i].Status, + type: user.Organizations[i].Type }); } diff --git a/src/app/settings/views/settings.html b/src/app/settings/views/settings.html index ccbd572789..24b8348f98 100644 --- a/src/app/settings/views/settings.html +++ b/src/app/settings/views/settings.html @@ -118,8 +118,10 @@