convert vault listing to ciphers

This commit is contained in:
Kyle Spearrin 2017-10-06 22:01:17 -04:00
parent c4d2045884
commit 3b71760f9e
6 changed files with 143 additions and 140 deletions

View File

@ -368,7 +368,7 @@ angular
// user is guaranteed to be authenticated becuase of previous check // user is guaranteed to be authenticated becuase of previous check
if (toState.name.indexOf('backend.org.') > -1 && toParams.orgId) { if (toState.name.indexOf('backend.org.') > -1 && toParams.orgId) {
// clear vault rootScope when visiting org admin section // clear vault rootScope when visiting org admin section
$rootScope.vaultLogins = $rootScope.vaultFolders = null; $rootScope.vaultCiphers = $rootScope.vaultFolders = null;
authService.getUserProfile().then(function (profile) { authService.getUserProfile().then(function (profile) {
var orgs = profile.organizations; var orgs = profile.organizations;

View File

@ -95,7 +95,7 @@ angular
_service.logOut = function () { _service.logOut = function () {
tokenService.clearTokens(); tokenService.clearTokens();
cryptoService.clearKeys(); cryptoService.clearKeys();
$rootScope.vaultFolders = $rootScope.vaultLogins = null; $rootScope.vaultFolders = $rootScope.vaultCiphers = null;
_userProfile = null; _userProfile = null;
}; };

View File

@ -181,11 +181,13 @@ angular
id: encryptedCipher.Id, id: encryptedCipher.Id,
organizationId: encryptedCipher.OrganizationId, organizationId: encryptedCipher.OrganizationId,
collectionIds: encryptedCipher.CollectionIds || [], collectionIds: encryptedCipher.CollectionIds || [],
'type': encryptedCipher.Type,
folderId: encryptedCipher.FolderId, folderId: encryptedCipher.FolderId,
favorite: encryptedCipher.Favorite, favorite: encryptedCipher.Favorite,
edit: encryptedCipher.Edit, edit: encryptedCipher.Edit,
organizationUseTotp: encryptedCipher.OrganizationUseTotp, organizationUseTotp: encryptedCipher.OrganizationUseTotp,
hasAttachments: !!encryptedCipher.Attachments && encryptedCipher.Attachments.length > 0 hasAttachments: !!encryptedCipher.Attachments && encryptedCipher.Attachments.length > 0,
meta: {}
}; };
var cipherData = encryptedCipher.Data; var cipherData = encryptedCipher.Data;
@ -196,13 +198,13 @@ angular
switch (cipher.type) { switch (cipher.type) {
case constants.cipherType.login: case constants.cipherType.login:
cipher.subTitle = _service.decryptProperty(cipherData.Username, key, true); cipher.subTitle = _service.decryptProperty(cipherData.Username, key, true);
cipher.password = _service.decryptProperty(cipherData.Password, key, true); cipher.meta.password = _service.decryptProperty(cipherData.Password, key, true);
break; break;
case constants.cipherType.secureNote: case constants.cipherType.secureNote:
cipher.subTitle = 'secure note'; // TODO: what to do for this sub title? cipher.subTitle = 'secure note'; // TODO: what to do for this sub title?
break; break;
case constants.cipherType.card: case constants.cipherType.card:
cipher.number = _service.decryptProperty(cipherData.Number, key, true); cipher.meta.number = _service.decryptProperty(cipherData.Number, key, true);
var brand = _service.decryptProperty(cipherData.Brand, key, true); var brand = _service.decryptProperty(cipherData.Brand, key, true);
cipher.subTitle = brand + ', *1234'; // TODO: last 4 of number cipher.subTitle = brand + ', *1234'; // TODO: last 4 of number
break; break;
@ -215,7 +217,7 @@ angular
} }
} }
return login; return cipher;
}; };
_service.decryptAttachment = function (key, encryptedAttachment) { _service.decryptAttachment = function (key, encryptedAttachment) {

View File

@ -4,19 +4,19 @@
.controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr, .controller('vaultController', function ($scope, $uibModal, apiService, $filter, cryptoService, authService, toastr,
cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics) { cipherService, $q, $localStorage, $timeout, $rootScope, $state, $analytics) {
$scope.loading = true; $scope.loading = true;
$scope.logins = []; $scope.ciphers = [];
$scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders; $scope.favoriteCollapsed = $localStorage.collapsedFolders && 'favorite' in $localStorage.collapsedFolders;
$scope.folderIdFilter = undefined; $scope.folderIdFilter = undefined;
if ($state.params.refreshFromServer) { if ($state.params.refreshFromServer) {
$rootScope.vaultFolders = $rootScope.vaultLogins = null; $rootScope.vaultFolders = $rootScope.vaultCiphers = null;
} }
$scope.$on('$viewContentLoaded', function () { $scope.$on('$viewContentLoaded', function () {
if ($rootScope.vaultFolders && $rootScope.vaultLogins) { if ($rootScope.vaultFolders && $rootScope.vaultCiphers) {
$scope.loading = false; $scope.loading = false;
loadFolderData($rootScope.vaultFolders); loadFolderData($rootScope.vaultFolders);
loadLoginData($rootScope.vaultLogins); loadCipherData($rootScope.vaultCiphers);
return; return;
} }
@ -39,17 +39,17 @@
}).$promise; }).$promise;
var cipherPromise = apiService.ciphers.list({}, function (ciphers) { var cipherPromise = apiService.ciphers.list({}, function (ciphers) {
var decLogins = []; var decCiphers = [];
for (var i = 0; i < ciphers.Data.length; i++) { for (var i = 0; i < ciphers.Data.length; i++) {
if (ciphers.Data[i].Type === 1) { if (ciphers.Data[i].Type === 1) {
var decLogin = cipherService.decryptLoginPreview(ciphers.Data[i]); var decCipher = cipherService.decryptCipherPreview(ciphers.Data[i]);
decLogins.push(decLogin); decCiphers.push(decCipher);
} }
} }
$q.when(folderPromise).then(function () { folderPromise.then(function () {
loadLoginData(decLogins); loadCipherData(decCiphers);
}); });
}).$promise; }).$promise;
@ -62,26 +62,26 @@
$rootScope.vaultFolders = $filter('orderBy')(decFolders, folderSort); $rootScope.vaultFolders = $filter('orderBy')(decFolders, folderSort);
} }
function loadLoginData(decLogins) { function loadCipherData(decCiphers) {
angular.forEach($rootScope.vaultFolders, function (folderValue, folderIndex) { angular.forEach($rootScope.vaultFolders, function (folderValue, folderIndex) {
folderValue.collapsed = $localStorage.collapsedFolders && folderValue.collapsed = $localStorage.collapsedFolders &&
(folderValue.id || 'none') in $localStorage.collapsedFolders; (folderValue.id || 'none') in $localStorage.collapsedFolders;
angular.forEach(decLogins, function (loginValue) { angular.forEach(decCiphers, function (cipherValue) {
if (loginValue.favorite) { if (cipherValue.favorite) {
loginValue.sort = -1; cipherValue.sort = -1;
} }
else if (loginValue.folderId == folderValue.id) { else if (cipherValue.folderId == folderValue.id) {
loginValue.sort = folderIndex; cipherValue.sort = folderIndex;
} }
}); });
}); });
$rootScope.vaultLogins = $scope.logins = $filter('orderBy')(decLogins, ['sort', 'name', 'username']); $rootScope.vaultCiphers = $scope.ciphers = $filter('orderBy')(decCiphers, ['sort', 'name', 'subTitle']);
var chunks = chunk($rootScope.vaultLogins, 400); var chunks = chunk($rootScope.vaultCiphers, 400);
if (chunks.length > 0) { if (chunks.length > 0) {
$scope.logins = chunks[0]; $scope.ciphers = chunks[0];
var delay = 200; var delay = 200;
angular.forEach(chunks, function (value, index) { angular.forEach(chunks, function (value, index) {
delay += 200; delay += 200;
@ -89,15 +89,15 @@
// skip the first chuck // skip the first chuck
if (index > 0) { if (index > 0) {
$timeout(function () { $timeout(function () {
Array.prototype.push.apply($scope.logins, value); Array.prototype.push.apply($scope.ciphers, value);
}, delay); }, delay);
} }
}); });
} }
} }
function sortScopedLoginData() { function sortScopedCipherData() {
$rootScope.vaultLogins = $scope.logins = $filter('orderBy')($rootScope.vaultLogins, ['name', 'username']); $rootScope.vaultCiphers = $scope.ciphers = $filter('orderBy')($rootScope.vaultCiphers, ['name', 'subTitle']);
} }
function chunk(arr, len) { function chunk(arr, len) {
@ -120,7 +120,7 @@
$scope.clipboardError = function (e) { $scope.clipboardError = function (e) {
alert('Your web browser does not support easy clipboard copying. ' + alert('Your web browser does not support easy clipboard copying. ' +
'Edit the login and copy it manually instead.'); 'Edit the item and copy it manually instead.');
}; };
$scope.collapseExpand = function (folder, favorite) { $scope.collapseExpand = function (folder, favorite) {
@ -137,7 +137,7 @@
} }
}; };
$scope.editLogin = function (cipher) { $scope.editCipher = function (cipher) {
var editModel = $uibModal.open({ var editModel = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/vault/views/vaultEditCipher.html', templateUrl: 'app/vault/views/vaultEditCipher.html',
@ -151,27 +151,28 @@
if (returnVal.action === 'edit') { if (returnVal.action === 'edit') {
cipher.folderId = returnVal.data.folderId; cipher.folderId = returnVal.data.folderId;
cipher.name = returnVal.data.name; cipher.name = returnVal.data.name;
cipher.username = returnVal.data.login.username;
cipher.password = returnVal.data.login.password;
cipher.favorite = returnVal.data.favorite; cipher.favorite = returnVal.data.favorite;
sortScopedLoginData(); cipher.subTitle = returnVal.data.login.username;
cipher.meta.password = returnVal.data.login.password;
sortScopedCipherData();
} }
else if (returnVal.action === 'partialEdit') { else if (returnVal.action === 'partialEdit') {
cipher.folderId = returnVal.data.folderId; cipher.folderId = returnVal.data.folderId;
cipher.favorite = returnVal.data.favorite; cipher.favorite = returnVal.data.favorite;
} }
else if (returnVal.action === 'delete') { else if (returnVal.action === 'delete') {
removeLoginFromScopes(cipher); removeCipherFromScopes(cipher);
} }
}); });
}; };
$scope.$on('vaultAddLogin', function (event, args) { $scope.$on('vaultAddLogin', function (event, args) {
$scope.addLogin(); $scope.addCipher();
}); });
$scope.addLogin = function (folder, favorite) { $scope.addCipher = function (folder, favorite) {
var addModel = $uibModal.open({ var addModel = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/vault/views/vaultAddLogin.html', templateUrl: 'app/vault/views/vaultAddLogin.html',
@ -182,44 +183,44 @@
} }
}); });
addModel.result.then(function (addedLogin) { addModel.result.then(function (addedCipher) {
$rootScope.vaultLogins.push(addedLogin); $rootScope.vaultCiphers.push(addedCipher);
sortScopedLoginData(); sortScopedCipherData();
}); });
}; };
$scope.deleteLogin = function (login) { $scope.deleteCipher = function (cipher) {
if (!confirm('Are you sure you want to delete this login (' + login.name + ')?')) { if (!confirm('Are you sure you want to delete this item (' + cipher.name + ')?')) {
return; return;
} }
apiService.ciphers.del({ id: login.id }, function () { apiService.ciphers.del({ id: cipher.id }, function () {
$analytics.eventTrack('Deleted Login'); $analytics.eventTrack('Deleted Item');
removeLoginFromScopes(login); removeCipherFromScopes(cipher);
}); });
}; };
$scope.attachments = function (login) { $scope.attachments = function (cipher) {
authService.getUserProfile().then(function (profile) { authService.getUserProfile().then(function (profile) {
return { return {
isPremium: profile.premium, isPremium: profile.premium,
orgUseStorage: login.organizationId && !!profile.organizations[login.organizationId].maxStorageGb orgUseStorage: cipher.organizationId && !!profile.organizations[cipher.organizationId].maxStorageGb
}; };
}).then(function (perms) { }).then(function (perms) {
if (!login.hasAttachments) { if (!cipher.hasAttachments) {
if (login.organizationId && !perms.orgUseStorage) { if (cipher.organizationId && !perms.orgUseStorage) {
$uibModal.open({ $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/views/paidOrgRequired.html', templateUrl: 'app/views/paidOrgRequired.html',
controller: 'paidOrgRequiredController', controller: 'paidOrgRequiredController',
resolve: { resolve: {
orgId: function () { return login.organizationId; } orgId: function () { return cipher.organizationId; }
} }
}); });
return; return;
} }
if (!login.organizationId && !perms.isPremium) { if (!cipher.organizationId && !perms.isPremium) {
$uibModal.open({ $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/views/premiumRequired.html', templateUrl: 'app/views/premiumRequired.html',
@ -229,7 +230,7 @@
} }
} }
if (!login.organizationId && !cryptoService.getEncKey()) { if (!cipher.organizationId && !cryptoService.getEncKey()) {
toastr.error('You cannot use this feature until you update your encryption key.', 'Feature Unavailable'); toastr.error('You cannot use this feature until you update your encryption key.', 'Feature Unavailable');
return; return;
} }
@ -239,12 +240,12 @@
templateUrl: 'app/vault/views/vaultAttachments.html', templateUrl: 'app/vault/views/vaultAttachments.html',
controller: 'vaultAttachmentsController', controller: 'vaultAttachmentsController',
resolve: { resolve: {
loginId: function () { return login.id; } loginId: function () { return cipher.id; }
} }
}); });
attachmentModel.result.then(function (hasAttachments) { attachmentModel.result.then(function (hasAttachments) {
login.hasAttachments = hasAttachments; cipher.hasAttachments = hasAttachments;
}); });
}); });
}; };
@ -298,42 +299,42 @@
}; };
$scope.canDeleteFolder = function (folder) { $scope.canDeleteFolder = function (folder) {
if (!folder || !folder.id || !$rootScope.vaultLogins) { if (!folder || !folder.id || !$rootScope.vaultCiphers) {
return false; return false;
} }
var logins = $filter('filter')($rootScope.vaultLogins, { folderId: folder.id }); var ciphers = $filter('filter')($rootScope.vaultCiphers, { folderId: folder.id });
return logins && logins.length === 0; return ciphers && ciphers.length === 0;
}; };
$scope.share = function (login) { $scope.share = function (cipher) {
var modal = $uibModal.open({ var modal = $uibModal.open({
animation: true, animation: true,
templateUrl: 'app/vault/views/vaultShareLogin.html', templateUrl: 'app/vault/views/vaultShareLogin.html',
controller: 'vaultShareLoginController', controller: 'vaultShareLoginController',
resolve: { resolve: {
loginId: function () { return login.id; } loginId: function () { return cipher.id; }
} }
}); });
modal.result.then(function (orgId) { modal.result.then(function (orgId) {
login.organizationId = orgId; cipher.organizationId = orgId;
}); });
}; };
$scope.collections = function (login) { $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/vaultLoginCollections.html',
controller: 'vaultLoginCollectionsController', controller: 'vaultLoginCollectionsController',
resolve: { resolve: {
loginId: function () { return login.id; } loginId: function () { return cipher.id; }
} }
}); });
modal.result.then(function (response) { modal.result.then(function (response) {
if (response.collectionIds && !response.collectionIds.length) { if (response.collectionIds && !response.collectionIds.length) {
removeLoginFromScopes(login); removeCipherFromScopes(cipher);
} }
}); });
}; };
@ -367,12 +368,12 @@
}; };
$scope.selectFolder = function (folder, $event) { $scope.selectFolder = function (folder, $event) {
var checkbox = $($event.currentTarget).closest('.box').find('input[name="loginSelection"]'); var checkbox = $($event.currentTarget).closest('.box').find('input[name="cipherSelection"]');
checkbox.prop('checked', true); checkbox.prop('checked', true);
}; };
$scope.select = function ($event) { $scope.select = function ($event) {
var checkbox = $($event.currentTarget).closest('tr').find('input[name="loginSelection"]'); var checkbox = $($event.currentTarget).closest('tr').find('input[name="cipherSelection"]');
checkbox.prop('checked', !checkbox.prop('checked')); checkbox.prop('checked', !checkbox.prop('checked'));
}; };
@ -380,18 +381,18 @@
return self.indexOf(value) === index; return self.indexOf(value) === index;
} }
function getSelectedLogins() { function getSelectedCiphers() {
return $('input[name="loginSelection"]:checked').map(function () { return $('input[name="cipherSelection"]:checked').map(function () {
return $(this).val(); return $(this).val();
}).get().filter(distinct); }).get().filter(distinct);
} }
function selectAll(select) { function selectAll(select) {
$('input[name="loginSelection"]').prop('checked', select); $('input[name="cipherSelection"]').prop('checked', select);
} }
$scope.bulkMove = function () { $scope.bulkMove = function () {
var ids = getSelectedLogins(); var ids = getSelectedCiphers();
if (ids.length === 0) { if (ids.length === 0) {
alert('You have not selected anything.'); alert('You have not selected anything.');
return; return;
@ -409,37 +410,37 @@
modal.result.then(function (folderId) { modal.result.then(function (folderId) {
for (var i = 0; i < ids.length; i++) { for (var i = 0; i < ids.length; i++) {
var login = $filter('filter')($rootScope.vaultLogins, { id: ids[i] }); var cipher = $filter('filter')($rootScope.vaultCiphers, { id: ids[i] });
if (login.length) { if (cipher.length) {
login[0].folderId = folderId; cipher[0].folderId = folderId;
} }
} }
selectAll(false); selectAll(false);
sortScopedLoginData(); sortScopedCipherData();
toastr.success('Items have been moved!'); toastr.success('Items have been moved!');
}); });
}; };
$scope.bulkDelete = function () { $scope.bulkDelete = function () {
var ids = getSelectedLogins(); var ids = getSelectedCiphers();
if (ids.length === 0) { if (ids.length === 0) {
alert('You have not selected anything.'); alert('You have not selected anything.');
return; return;
} }
if (!confirm('Are you sure you want to delete the selected logins (total: ' + ids.length + ')?')) { if (!confirm('Are you sure you want to delete the selected items (total: ' + ids.length + ')?')) {
return; return;
} }
$scope.bulkActionLoading = true; $scope.bulkActionLoading = true;
apiService.ciphers.delMany({ ids: ids }, function () { apiService.ciphers.delMany({ ids: ids }, function () {
$analytics.eventTrack('Bulk Deleted Logins'); $analytics.eventTrack('Bulk Deleted Items');
for (var i = 0; i < ids.length; i++) { for (var i = 0; i < ids.length; i++) {
var login = $filter('filter')($rootScope.vaultLogins, { id: ids[i] }); var cipher = $filter('filter')($rootScope.vaultCiphers, { id: ids[i] });
if (login.length && login[0].edit) { if (cipher.length && cipher[0].edit) {
removeLoginFromScopes(login[0]); removeCipherFromScopes(cipher[0]);
} }
} }
@ -452,15 +453,15 @@
}); });
}; };
function removeLoginFromScopes(login) { function removeCipherFromScopes(cipher) {
var index = $rootScope.vaultLogins.indexOf(login); var index = $rootScope.vaultCiphers.indexOf(cipher);
if (index > -1) { if (index > -1) {
$rootScope.vaultLogins.splice(index, 1); $rootScope.vaultCiphers.splice(index, 1);
} }
index = $scope.logins.indexOf(login); index = $scope.ciphers.indexOf(cipher);
if (index > -1) { if (index > -1) {
$scope.logins.splice(index, 1); $scope.ciphers.splice(index, 1);
} }
} }
}); });

View File

@ -212,8 +212,8 @@
}; };
function findRootLogin(login) { function findRootLogin(login) {
if ($rootScope.vaultLogins) { if ($rootScope.vaultCiphers) {
var rootLogins = $filter('filter')($rootScope.vaultLogins, { id: login.id }); var rootLogins = $filter('filter')($rootScope.vaultCiphers, { id: login.id });
if (rootLogins && rootLogins.length) { if (rootLogins && rootLogins.length) {
return rootLogins[0]; return rootLogins[0];
} }
@ -224,9 +224,9 @@
function removeRootLogin(rootLogin) { function removeRootLogin(rootLogin) {
if (rootLogin && rootLogin.id) { if (rootLogin && rootLogin.id) {
var index = $rootScope.vaultLogins.indexOf(rootLogin); var index = $rootScope.vaultCiphers.indexOf(rootLogin);
if (index > -1) { if (index > -1) {
$rootScope.vaultLogins.splice(index, 1); $rootScope.vaultCiphers.splice(index, 1);
} }
} }
} }

View File

@ -30,7 +30,7 @@
<span ng-pluralize <span ng-pluralize
count="vaultFolders.length > 0 ? vaultFolders.length - 1 : 0" count="vaultFolders.length > 0 ? vaultFolders.length - 1 : 0"
when="{'1': '{} folder', 'other': '{} folders'}"></span>, when="{'1': '{} folder', 'other': '{} folders'}"></span>,
<span ng-pluralize count="logins.length" when="{'1': '{} login', 'other': '{} logins'}"></span> <span ng-pluralize count="ciphers.length" when="{'1': '{} item', 'other': '{} items'}"></span>
</small> </small>
</h1> </h1>
</section> </section>
@ -39,12 +39,12 @@
<p>Loading...</p> <p>Loading...</p>
</div> </div>
<div class="box box-primary" ng-class="{'collapsed-box': favoriteCollapsed}" style="margin-bottom: 40px;" <div class="box box-primary" ng-class="{'collapsed-box': favoriteCollapsed}" style="margin-bottom: 40px;"
ng-show="vaultFolders.length && folderIdFilter === undefined && (!main.searchVaultText || favoriteLogins.length)"> ng-show="vaultFolders.length && folderIdFilter === undefined && (!main.searchVaultText || favoriteCiphers.length)">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"> <h3 class="box-title">
<i class="fa fa-star"></i> <i class="fa fa-star"></i>
Favorites Favorites
<small ng-pluralize count="favoriteLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small> <small ng-pluralize count="favoriteCiphers.length" when="{'1': '{} item', 'other': '{} items'}"></small>
</h3> </h3>
<div class="box-tools"> <div class="box-tools">
<div class="btn-group"> <div class="btn-group">
@ -53,8 +53,8 @@
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li> <li>
<a href="#" stop-click ng-click="addLogin(null, true)"> <a href="#" stop-click ng-click="addCipher(null, true)">
<i class="fa fa-fw fa-plus-circle"></i> Add Login <i class="fa fa-fw fa-plus-circle"></i> Add Item
</a> </a>
</li> </li>
</ul> </ul>
@ -65,16 +65,16 @@
</button> </button>
</div> </div>
</div> </div>
<div class="box-body" ng-class="{'no-padding': favoriteLogins.length}"> <div class="box-body" ng-class="{'no-padding': favoriteCiphers.length}">
<div ng-show="!favoriteLogins.length"> <div ng-show="!favoriteCiphers.length">
<p>No favorite logins.</p> <p>No favorite items.</p>
<button type="button" ng-click="addLogin(null, true)" class="btn btn-default btn-flat">Add a Login</button> <button type="button" ng-click="addCipher(null, true)" class="btn btn-default btn-flat">Add an Item</button>
</div> </div>
<div class="table-responsive" ng-show="favoriteLogins.length"> <div class="table-responsive" ng-show="favoriteCiphers.length">
<table class="table table-striped table-hover table-vmiddle"> <table class="table table-striped table-hover table-vmiddle">
<tbody> <tbody>
<tr ng-repeat="login in favoriteLogins = (logins | filter: { favorite: true } | <tr ng-repeat="cipher in favoriteCiphers = (ciphers | filter: { favorite: true } |
filter: (main.searchVaultText || '')) track by login.id"> filter: (main.searchVaultText || '')) track by cipher.id">
<td style="width: 70px;"> <td style="width: 70px;">
<div class="btn-group" data-append-to="body"> <div class="btn-group" data-append-to="body">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@ -82,33 +82,33 @@
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a href="#" stop-click ng-click="editLogin(login)"> <a href="#" stop-click ng-click="editCipher(cipher)">
<i class="fa fa-fw fa-pencil"></i> Edit <i class="fa fa-fw fa-pencil"></i> Edit
</a> </a>
</li> </li>
<li> <li>
<a href="#" stop-click ng-click="attachments(login)"> <a href="#" stop-click ng-click="attachments(cipher)">
<i class="fa fa-fw fa-paperclip"></i> Attachments <i class="fa fa-fw fa-paperclip"></i> Attachments
</a> </a>
</li> </li>
<li ng-show="!login.organizationId"> <li ng-show="!cipher.organizationId">
<a href="#" stop-click ng-click="share(login)"> <a href="#" stop-click ng-click="share(cipher)">
<i class="fa fa-fw fa-share-alt"></i> Share <i class="fa fa-fw fa-share-alt"></i> Share
</a> </a>
</li> </li>
<li ng-show="login.organizationId && login.edit"> <li ng-show="cipher.organizationId && cipher.edit">
<a href="#" stop-click ng-click="collections(login)"> <a href="#" stop-click ng-click="collections(cipher)">
<i class="fa fa-fw fa-cubes"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li ng-show="login.password"> <li ng-show="cipher.meta.password">
<a href="#" stop-click ngclipboard ngclipboard-error="clipboardError(e)" <a href="#" stop-click ngclipboard ngclipboard-error="clipboardError(e)"
data-clipboard-text="{{login.password}}"> data-clipboard-text="{{cipher.meta.password}}">
<i class="fa fa-fw fa-clipboard"></i> Copy Password <i class="fa fa-fw fa-clipboard"></i> Copy Password
</a> </a>
</li> </li>
<li ng-show="login.edit"> <li ng-show="cipher.edit">
<a href="#" stop-click ng-click="deleteLogin(login)" class="text-red"> <a href="#" stop-click ng-click="deleteCipher(cipher)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete <i class="fa fa-fw fa-trash"></i> Delete
</a> </a>
</li> </li>
@ -116,15 +116,15 @@
</div> </div>
</td> </td>
<td class="action-select"> <td class="action-select">
<input type="checkbox" value="{{::login.id}}" name="loginSelection" /> <input type="checkbox" value="{{::cipher.id}}" name="cipherSelection" />
</td> </td>
<td ng-click="select($event)"> <td ng-click="select($event)">
<a href="#" stop-click ng-click="editLogin(login)" stop-prop>{{login.name}}</a> <a href="#" stop-click ng-click="editCipher(cipher)" stop-prop>{{cipher.name}}</a>
<i class="fa fa-share-alt text-muted" title="Shared" ng-if="login.organizationId" <i class="fa fa-share-alt text-muted" title="Shared" ng-if="cipher.organizationId"
stop-prop></i> stop-prop></i>
<i class="fa fa-paperclip text-muted" title="Attachments" ng-if="login.hasAttachments" <i class="fa fa-paperclip text-muted" title="Attachments" ng-if="cipher.hasAttachments"
stop-prop></i><br /> stop-prop></i><br />
<span class="text-sm text-muted" stop-prop>{{login.username}}</span> <span class="text-sm text-muted" stop-prop>{{cipher.subTitle}}</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
@ -134,12 +134,12 @@
</div> </div>
<div class="box" ng-class="{'collapsed-box': folder.collapsed}" <div class="box" ng-class="{'collapsed-box': folder.collapsed}"
ng-repeat="folder in filteredVaultFolders = (vaultFolders | filter: folderFilter) track by folder.id" ng-repeat="folder in filteredVaultFolders = (vaultFolders | filter: folderFilter) track by folder.id"
ng-show="vaultFolders.length && (!main.searchVaultText || folderLogins.length)"> ng-show="vaultFolders.length && (!main.searchVaultText || folderCiphers.length)">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title"> <h3 class="box-title">
<i class="fa" ng-class="{'fa-folder-open': folder.id !== null, 'fa-folder-open-o': folder.id === null}"></i> <i class="fa" ng-class="{'fa-folder-open': folder.id !== null, 'fa-folder-open-o': folder.id === null}"></i>
{{folder.name}} {{folder.name}}
<small ng-pluralize count="folderLogins.length" when="{'1': '{} login', 'other': '{} logins'}"></small> <small ng-pluralize count="folderCiphers.length" when="{'1': '{} item', 'other': '{} items'}"></small>
</h3> </h3>
<div class="box-tools"> <div class="box-tools">
<div class="btn-group"> <div class="btn-group">
@ -148,8 +148,8 @@
</button> </button>
<ul class="dropdown-menu dropdown-menu-right"> <ul class="dropdown-menu dropdown-menu-right">
<li> <li>
<a href="#" stop-click ng-click="addLogin(folder)"> <a href="#" stop-click ng-click="addCipher(folder)">
<i class="fa fa-fw fa-plus-circle"></i> Add Login <i class="fa fa-fw fa-plus-circle"></i> Add Item
</a> </a>
</li> </li>
<li ng-show="folder.id"> <li ng-show="folder.id">
@ -175,16 +175,16 @@
</button> </button>
</div> </div>
</div> </div>
<div class="box-body" ng-class="{'no-padding': folderLogins.length}"> <div class="box-body" ng-class="{'no-padding': folderCiphers.length}">
<div ng-show="!folderLogins.length"> <div ng-show="!folderCiphers.length">
<p>No logins in this folder.</p> <p>No items in this folder.</p>
<button type="button" ng-click="addLogin(folder)" class="btn btn-default btn-flat">Add a Login</button> <button type="button" ng-click="addCipher(folder)" class="btn btn-default btn-flat">Add an Item</button>
</div> </div>
<div class="table-responsive" ng-show="folderLogins.length"> <div class="table-responsive" ng-show="folderCiphers.length">
<table class="table table-striped table-hover table-vmiddle"> <table class="table table-striped table-hover table-vmiddle">
<tbody> <tbody>
<tr ng-repeat="login in folderLogins = (logins | filter: { folderId: folder.id } | <tr ng-repeat="cipher in folderCiphers = (ciphers | filter: { folderId: folder.id } |
filter: (main.searchVaultText || '')) track by login.id"> filter: (main.searchVaultText || '')) track by cipher.id">
<td style="width: 70px;"> <td style="width: 70px;">
<div class="btn-group" data-append-to="body"> <div class="btn-group" data-append-to="body">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
@ -192,33 +192,33 @@
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <li>
<a href="#" stop-click ng-click="editLogin(login)"> <a href="#" stop-click ng-click="editCipher(cipher)">
<i class="fa fa-fw fa-pencil"></i> Edit <i class="fa fa-fw fa-pencil"></i> Edit
</a> </a>
</li> </li>
<li> <li>
<a href="#" stop-click ng-click="attachments(login)"> <a href="#" stop-click ng-click="attachments(cipher)">
<i class="fa fa-fw fa-paperclip"></i> Attachments <i class="fa fa-fw fa-paperclip"></i> Attachments
</a> </a>
</li> </li>
<li ng-show="!login.organizationId"> <li ng-show="!cipher.organizationId">
<a href="#" stop-click ng-click="share(login)"> <a href="#" stop-click ng-click="share(cipher)">
<i class="fa fa-fw fa-share-alt"></i> Share <i class="fa fa-fw fa-share-alt"></i> Share
</a> </a>
</li> </li>
<li ng-show="login.organizationId && login.edit"> <li ng-show="cipher.organizationId && cipher.edit">
<a href="#" stop-click ng-click="collections(login)"> <a href="#" stop-click ng-click="collections(cipher)">
<i class="fa fa-fw fa-cubes"></i> Collections <i class="fa fa-fw fa-cubes"></i> Collections
</a> </a>
</li> </li>
<li ng-show="login.password"> <li ng-show="cipher.meta.password">
<a href="#" stop-click ngclipboard ngclipboard-error="clipboardError(e)" <a href="#" stop-click ngclipboard ngclipboard-error="clipboardError(e)"
data-clipboard-text="{{login.password}}"> data-clipboard-text="{{cipher.meta.password}}">
<i class="fa fa-fw fa-clipboard"></i> Copy Password <i class="fa fa-fw fa-clipboard"></i> Copy Password
</a> </a>
</li> </li>
<li ng-show="login.edit"> <li ng-show="cipher.edit">
<a href="#" stop-click ng-click="deleteLogin(login)" class="text-red"> <a href="#" stop-click ng-click="deleteCipher(cipher)" class="text-red">
<i class="fa fa-fw fa-trash"></i> Delete <i class="fa fa-fw fa-trash"></i> Delete
</a> </a>
</li> </li>
@ -226,17 +226,17 @@
</div> </div>
</td> </td>
<td class="action-select" ng-click="select($event)"> <td class="action-select" ng-click="select($event)">
<input type="checkbox" value="{{::login.id}}" name="loginSelection" stop-prop /> <input type="checkbox" value="{{::cipher.id}}" name="cipherSelection" stop-prop />
</td> </td>
<td ng-click="select($event)"> <td ng-click="select($event)">
<a href="#" stop-click ng-click="editLogin(login)" stop-prop>{{login.name}}</a> <a href="#" stop-click ng-click="editCipher(cipher)" stop-prop>{{cipher.name}}</a>
<i class="fa fa-star text-muted" title="Favorite" ng-show="login.favorite" stop-prop></i> <i class="fa fa-star text-muted" title="Favorite" ng-show="cipher.favorite" stop-prop></i>
<i class="fa fa-share-alt text-muted" title="Shared" ng-show="login.organizationId" <i class="fa fa-share-alt text-muted" title="Shared" ng-show="cipher.organizationId"
stop-prop></i> stop-prop></i>
<i class="fa fa-paperclip text-muted" title="Attachments" ng-if="login.hasAttachments" <i class="fa fa-paperclip text-muted" title="Attachments" ng-if="cipher.hasAttachments"
stop-prop></i> stop-prop></i>
<br /> <br />
<span class="text-sm text-muted" stop-prop>{{login.username}}</span> <span class="text-sm text-muted" stop-prop>{{cipher.subTitle}}</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>