diff --git a/src/app/vault/vaultAttachmentsController.js b/src/app/vault/vaultAttachmentsController.js index 910ccf1986..c2d839fa0c 100644 --- a/src/app/vault/vaultAttachmentsController.js +++ b/src/app/vault/vaultAttachmentsController.js @@ -2,9 +2,9 @@ .module('bit.vault') .controller('vaultAttachmentsController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService, - loginId, $analytics, validationService, toastr, $timeout, authService, $uibModal) { + cipherId, $analytics, validationService, toastr, $timeout, authService, $uibModal) { $analytics.eventTrack('vaultAttachmentsController', { category: 'Modal' }); - $scope.login = {}; + $scope.cipher = {}; $scope.readOnly = true; $scope.loading = true; $scope.isPremium = true; @@ -13,11 +13,11 @@ authService.getUserProfile().then(function (profile) { $scope.isPremium = profile.premium; - return apiService.ciphers.get({ id: loginId }).$promise; + return apiService.ciphers.get({ id: cipherId }).$promise; }).then(function (cipher) { - $scope.login = cipherService.decryptLogin(cipher); - $scope.readOnly = !$scope.login.edit; - $scope.canUseAttachments = $scope.isPremium || $scope.login.organizationId; + $scope.cipher = cipherService.decryptCipher(cipher); + $scope.readOnly = !$scope.cipher.edit; + $scope.canUseAttachments = $scope.isPremium || $scope.cipher.organizationId; $scope.loading = false; }, function () { $scope.loading = false; @@ -31,14 +31,14 @@ return; } - $scope.savePromise = cipherService.encryptAttachmentFile(getKeyForLogin(), files[0]).then(function (encValue) { + $scope.savePromise = cipherService.encryptAttachmentFile(getKeyForCipher(), files[0]).then(function (encValue) { var fd = new FormData(); var blob = new Blob([encValue.data], { type: 'application/octet-stream' }); fd.append('data', blob, encValue.fileName); - return apiService.ciphers.postAttachment({ id: loginId }, fd).$promise; + return apiService.ciphers.postAttachment({ id: cipherId }, fd).$promise; }).then(function (response) { $analytics.eventTrack('Added Attachment'); - $scope.login = cipherService.decryptLogin(response); + $scope.cipher = cipherService.decryptCipher(response); // reset file input // ref: https://stackoverflow.com/a/20552042 @@ -64,7 +64,7 @@ return; } - cipherService.downloadAndDecryptAttachment(getKeyForLogin(), attachment, true).then(function (res) { + cipherService.downloadAndDecryptAttachment(getKeyForCipher(), attachment, true).then(function (res) { $timeout(function () { attachment.loading = false; }); @@ -75,9 +75,9 @@ }); }; - function getKeyForLogin() { - if ($scope.login.organizationId) { - return cryptoService.getOrgKey($scope.login.organizationId); + function getKeyForCipher() { + if ($scope.cipher.organizationId) { + return cryptoService.getOrgKey($scope.cipher.organizationId); } return null; @@ -89,12 +89,12 @@ } attachment.loading = true; - apiService.ciphers.delAttachment({ id: loginId, attachmentId: attachment.id }).$promise.then(function () { + apiService.ciphers.delAttachment({ id: cipherId, attachmentId: attachment.id }).$promise.then(function () { attachment.loading = false; $analytics.eventTrack('Deleted Attachment'); - var index = $scope.login.attachments.indexOf(attachment); + var index = $scope.cipher.attachments.indexOf(attachment); if (index > -1) { - $scope.login.attachments.splice(index, 1); + $scope.cipher.attachments.splice(index, 1); } }, function () { toastr.error('Cannot delete attachment.'); @@ -113,7 +113,7 @@ e.preventDefault(); closing = true; - $uibModalInstance.close(!!$scope.login.attachments && $scope.login.attachments.length > 0); + $uibModalInstance.close(!!$scope.cipher.attachments && $scope.cipher.attachments.length > 0); }); $scope.showUpgrade = function () { diff --git a/src/app/vault/vaultLoginCollectionsController.js b/src/app/vault/vaultCipherCollectionsController.js similarity index 86% rename from src/app/vault/vaultLoginCollectionsController.js rename to src/app/vault/vaultCipherCollectionsController.js index 83459b3805..b83a6b60c9 100644 --- a/src/app/vault/vaultLoginCollectionsController.js +++ b/src/app/vault/vaultCipherCollectionsController.js @@ -1,24 +1,24 @@ angular .module('bit.vault') - .controller('vaultLoginCollectionsController', function ($scope, apiService, $uibModalInstance, cipherService, - loginId, $analytics) { - $analytics.eventTrack('vaultLoginCollectionsController', { category: 'Modal' }); - $scope.login = {}; + .controller('vaultCipherCollectionsController', function ($scope, apiService, $uibModalInstance, cipherService, + cipherId, $analytics) { + $analytics.eventTrack('vaultCipherCollectionsController', { category: 'Modal' }); + $scope.cipher = {}; $scope.readOnly = false; - $scope.loadingLogin = true; + $scope.loadingCipher = true; $scope.loadingCollections = true; $scope.selectedCollections = {}; $scope.collections = []; $uibModalInstance.opened.then(function () { - apiService.ciphers.getDetails({ id: loginId }).$promise.then(function (cipher) { - $scope.loadingLogin = false; + apiService.ciphers.getDetails({ id: cipherId }).$promise.then(function (cipher) { + $scope.loadingCipher = false; $scope.readOnly = !cipher.Edit; if (cipher.Edit && cipher.OrganizationId) { if (cipher.Type === 1) { - $scope.login = cipherService.decryptLoginPreview(cipher); + $scope.cipher = cipherService.decryptCipherPreview(cipher); } var collections = {}; @@ -105,9 +105,9 @@ } } - $scope.submitPromise = apiService.ciphers.putCollections({ id: loginId }, request) + $scope.submitPromise = apiService.ciphers.putCollections({ id: cipherId }, request) .$promise.then(function (response) { - $analytics.eventTrack('Edited Login Collections'); + $analytics.eventTrack('Edited Cipher Collections'); $uibModalInstance.close({ action: 'collectionsEdit', collectionIds: request.collectionIds diff --git a/src/app/vault/vaultController.js b/src/app/vault/vaultController.js index 8ce0d20389..33ce7b8457 100644 --- a/src/app/vault/vaultController.js +++ b/src/app/vault/vaultController.js @@ -240,7 +240,7 @@ templateUrl: 'app/vault/views/vaultAttachments.html', controller: 'vaultAttachmentsController', resolve: { - loginId: function () { return cipher.id; } + cipherId: function () { return cipher.id; } } }); @@ -325,10 +325,10 @@ $scope.collections = function (cipher) { var modal = $uibModal.open({ animation: true, - templateUrl: 'app/vault/views/vaultLoginCollections.html', - controller: 'vaultLoginCollectionsController', + templateUrl: 'app/vault/views/vaultCipherCollections.html', + controller: 'vaultCipherCollectionsController', resolve: { - loginId: function () { return cipher.id; } + cipherId: function () { return cipher.id; } } }); diff --git a/src/app/vault/vaultSharedController.js b/src/app/vault/vaultSharedController.js index 8bfc55c033..b6257c711c 100644 --- a/src/app/vault/vaultSharedController.js +++ b/src/app/vault/vaultSharedController.js @@ -88,7 +88,7 @@ templateUrl: 'app/vault/views/vaultAttachments.html', controller: 'vaultAttachmentsController', resolve: { - loginId: function () { return cipher.id; } + cipherId: function () { return cipher.id; } } }); @@ -169,10 +169,10 @@ $scope.editCollections = function (cipher) { var modal = $uibModal.open({ animation: true, - templateUrl: 'app/vault/views/vaultLoginCollections.html', - controller: 'vaultLoginCollectionsController', + templateUrl: 'app/vault/views/vaultCipherCollections.html', + controller: 'vaultCipherCollectionsController', resolve: { - loginId: function () { return cipher.id; } + cipherId: function () { return cipher.id; } } }); diff --git a/src/app/vault/views/vaultAttachments.html b/src/app/vault/views/vaultAttachments.html index cf0fc3026a..75f9f12356 100644 --- a/src/app/vault/views/vaultAttachments.html +++ b/src/app/vault/views/vaultAttachments.html @@ -1,7 +1,7 @@ 
@@ -9,13 +9,13 @@
Loading...
-
- There are no attachments for this login. +
+ There are no attachments for this item.
-
+
- +
- +