more logins to cipher renames

This commit is contained in:
Kyle Spearrin 2017-10-11 09:57:18 -04:00
parent 1f26ff5c80
commit 2963516d5c
7 changed files with 43 additions and 43 deletions

View File

@ -2,9 +2,9 @@
.module('bit.vault') .module('bit.vault')
.controller('vaultAttachmentsController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService, .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' }); $analytics.eventTrack('vaultAttachmentsController', { category: 'Modal' });
$scope.login = {}; $scope.cipher = {};
$scope.readOnly = true; $scope.readOnly = true;
$scope.loading = true; $scope.loading = true;
$scope.isPremium = true; $scope.isPremium = true;
@ -13,11 +13,11 @@
authService.getUserProfile().then(function (profile) { authService.getUserProfile().then(function (profile) {
$scope.isPremium = profile.premium; $scope.isPremium = profile.premium;
return apiService.ciphers.get({ id: loginId }).$promise; return apiService.ciphers.get({ id: cipherId }).$promise;
}).then(function (cipher) { }).then(function (cipher) {
$scope.login = cipherService.decryptLogin(cipher); $scope.cipher = cipherService.decryptCipher(cipher);
$scope.readOnly = !$scope.login.edit; $scope.readOnly = !$scope.cipher.edit;
$scope.canUseAttachments = $scope.isPremium || $scope.login.organizationId; $scope.canUseAttachments = $scope.isPremium || $scope.cipher.organizationId;
$scope.loading = false; $scope.loading = false;
}, function () { }, function () {
$scope.loading = false; $scope.loading = false;
@ -31,14 +31,14 @@
return; 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 fd = new FormData();
var blob = new Blob([encValue.data], { type: 'application/octet-stream' }); var blob = new Blob([encValue.data], { type: 'application/octet-stream' });
fd.append('data', blob, encValue.fileName); 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) { }).then(function (response) {
$analytics.eventTrack('Added Attachment'); $analytics.eventTrack('Added Attachment');
$scope.login = cipherService.decryptLogin(response); $scope.cipher = cipherService.decryptCipher(response);
// reset file input // reset file input
// ref: https://stackoverflow.com/a/20552042 // ref: https://stackoverflow.com/a/20552042
@ -64,7 +64,7 @@
return; return;
} }
cipherService.downloadAndDecryptAttachment(getKeyForLogin(), attachment, true).then(function (res) { cipherService.downloadAndDecryptAttachment(getKeyForCipher(), attachment, true).then(function (res) {
$timeout(function () { $timeout(function () {
attachment.loading = false; attachment.loading = false;
}); });
@ -75,9 +75,9 @@
}); });
}; };
function getKeyForLogin() { function getKeyForCipher() {
if ($scope.login.organizationId) { if ($scope.cipher.organizationId) {
return cryptoService.getOrgKey($scope.login.organizationId); return cryptoService.getOrgKey($scope.cipher.organizationId);
} }
return null; return null;
@ -89,12 +89,12 @@
} }
attachment.loading = true; 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; attachment.loading = false;
$analytics.eventTrack('Deleted Attachment'); $analytics.eventTrack('Deleted Attachment');
var index = $scope.login.attachments.indexOf(attachment); var index = $scope.cipher.attachments.indexOf(attachment);
if (index > -1) { if (index > -1) {
$scope.login.attachments.splice(index, 1); $scope.cipher.attachments.splice(index, 1);
} }
}, function () { }, function () {
toastr.error('Cannot delete attachment.'); toastr.error('Cannot delete attachment.');
@ -113,7 +113,7 @@
e.preventDefault(); e.preventDefault();
closing = true; 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 () { $scope.showUpgrade = function () {

View File

@ -1,24 +1,24 @@
angular angular
.module('bit.vault') .module('bit.vault')
.controller('vaultLoginCollectionsController', function ($scope, apiService, $uibModalInstance, cipherService, .controller('vaultCipherCollectionsController', function ($scope, apiService, $uibModalInstance, cipherService,
loginId, $analytics) { cipherId, $analytics) {
$analytics.eventTrack('vaultLoginCollectionsController', { category: 'Modal' }); $analytics.eventTrack('vaultCipherCollectionsController', { category: 'Modal' });
$scope.login = {}; $scope.cipher = {};
$scope.readOnly = false; $scope.readOnly = false;
$scope.loadingLogin = true; $scope.loadingCipher = true;
$scope.loadingCollections = true; $scope.loadingCollections = true;
$scope.selectedCollections = {}; $scope.selectedCollections = {};
$scope.collections = []; $scope.collections = [];
$uibModalInstance.opened.then(function () { $uibModalInstance.opened.then(function () {
apiService.ciphers.getDetails({ id: loginId }).$promise.then(function (cipher) { apiService.ciphers.getDetails({ id: cipherId }).$promise.then(function (cipher) {
$scope.loadingLogin = false; $scope.loadingCipher = false;
$scope.readOnly = !cipher.Edit; $scope.readOnly = !cipher.Edit;
if (cipher.Edit && cipher.OrganizationId) { if (cipher.Edit && cipher.OrganizationId) {
if (cipher.Type === 1) { if (cipher.Type === 1) {
$scope.login = cipherService.decryptLoginPreview(cipher); $scope.cipher = cipherService.decryptCipherPreview(cipher);
} }
var collections = {}; 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) { .$promise.then(function (response) {
$analytics.eventTrack('Edited Login Collections'); $analytics.eventTrack('Edited Cipher Collections');
$uibModalInstance.close({ $uibModalInstance.close({
action: 'collectionsEdit', action: 'collectionsEdit',
collectionIds: request.collectionIds collectionIds: request.collectionIds

View File

@ -240,7 +240,7 @@
templateUrl: 'app/vault/views/vaultAttachments.html', templateUrl: 'app/vault/views/vaultAttachments.html',
controller: 'vaultAttachmentsController', controller: 'vaultAttachmentsController',
resolve: { resolve: {
loginId: function () { return cipher.id; } cipherId: function () { return cipher.id; }
} }
}); });
@ -325,10 +325,10 @@
$scope.collections = function (cipher) { $scope.collections = function (cipher) {
var modal = $uibModal.open({ var modal = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/vault/views/vaultLoginCollections.html', templateUrl: 'app/vault/views/vaultCipherCollections.html',
controller: 'vaultLoginCollectionsController', controller: 'vaultCipherCollectionsController',
resolve: { resolve: {
loginId: function () { return cipher.id; } cipherId: function () { return cipher.id; }
} }
}); });

View File

@ -88,7 +88,7 @@
templateUrl: 'app/vault/views/vaultAttachments.html', templateUrl: 'app/vault/views/vaultAttachments.html',
controller: 'vaultAttachmentsController', controller: 'vaultAttachmentsController',
resolve: { resolve: {
loginId: function () { return cipher.id; } cipherId: function () { return cipher.id; }
} }
}); });
@ -169,10 +169,10 @@
$scope.editCollections = function (cipher) { $scope.editCollections = function (cipher) {
var modal = $uibModal.open({ var modal = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/vault/views/vaultLoginCollections.html', templateUrl: 'app/vault/views/vaultCipherCollections.html',
controller: 'vaultLoginCollectionsController', controller: 'vaultCipherCollectionsController',
resolve: { resolve: {
loginId: function () { return cipher.id; } cipherId: function () { return cipher.id; }
} }
}); });

View File

@ -1,7 +1,7 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"> <h4 class="modal-title">
<i class="fa fa-paperclip"></i> Secure Attachments <small>{{login.name}}</small> <i class="fa fa-paperclip"></i> Secure Attachments <small>{{cipher.name}}</small>
</h4> </h4>
</div> </div>
<form name="form" ng-submit="form.$valid && save(form)" api-form="savePromise" autocomplete="off"> <form name="form" ng-submit="form.$valid && save(form)" api-form="savePromise" autocomplete="off">
@ -9,13 +9,13 @@
<div ng-if="loading"> <div ng-if="loading">
Loading... Loading...
</div> </div>
<div ng-if="!loading && !login.attachments.length"> <div ng-if="!loading && !cipher.attachments.length">
There are no attachments for this login. There are no attachments for this item.
</div> </div>
<div class="table-responsive" ng-if="login.attachments.length" style="margin: 0;"> <div class="table-responsive" ng-if="cipher.attachments.length" style="margin: 0;">
<table class="table table-striped table-hover table-vmiddle" style="margin: 0;"> <table class="table table-striped table-hover table-vmiddle" style="margin: 0;">
<tbody> <tbody>
<tr ng-repeat="attachment in login.attachments | orderBy: ['fileName']"> <tr ng-repeat="attachment in cipher.attachments | orderBy: ['fileName']">
<td style="width: 70px;"> <td style="width: 70px;">
<div class="btn-group" data-append-to=".modal"> <div class="btn-group" data-append-to=".modal">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">

View File

@ -1,10 +1,10 @@
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button> <button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><i class="fa fa-cubes"></i> Collections <small>{{login.name}}</small></h4> <h4 class="modal-title"><i class="fa fa-cubes"></i> Collections <small>{{cipher.name}}</small></h4>
</div> </div>
<form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise" autocomplete="off"> <form name="form" ng-submit="form.$valid && submit()" api-form="submitPromise" autocomplete="off">
<div class="modal-body"> <div class="modal-body">
<p>Edit the collections that this login is being shared with.</p> <p>Edit the collections that this item is being shared with.</p>
<div class="callout callout-danger validation-errors" ng-show="form.$errors"> <div class="callout callout-danger validation-errors" ng-show="form.$errors">
<h4>Errors have occurred</h4> <h4>Errors have occurred</h4>
<ul> <ul>

View File

@ -224,7 +224,7 @@
<script src="app/vault/vaultAddFolderController.js"></script> <script src="app/vault/vaultAddFolderController.js"></script>
<script src="app/vault/vaultShareCipherController.js"></script> <script src="app/vault/vaultShareCipherController.js"></script>
<script src="app/vault/vaultSharedController.js"></script> <script src="app/vault/vaultSharedController.js"></script>
<script src="app/vault/vaultLoginCollectionsController.js"></script> <script src="app/vault/vaultCipherCollectionsController.js"></script>
<script src="app/vault/vaultMoveCiphersController.js"></script> <script src="app/vault/vaultMoveCiphersController.js"></script>
<script src="app/vault/vaultAttachmentsController.js"></script> <script src="app/vault/vaultAttachmentsController.js"></script>