diff --git a/src/popup/app/services/authService.js b/src/popup/app/services/authService.js index 2ae76daced..6d08bc27d8 100644 --- a/src/popup/app/services/authService.js +++ b/src/popup/app/services/authService.js @@ -72,7 +72,7 @@ }; _service.logOut = function (callback) { - $rootScope.vaultLogins = null; + $rootScope.vaultCiphers = null; $rootScope.vaultFolders = null; callback(); }; diff --git a/src/popup/app/vault/vaultController.js b/src/popup/app/vault/vaultController.js index eef574b511..ea5a7b3a7b 100644 --- a/src/popup/app/vault/vaultController.js +++ b/src/popup/app/vault/vaultController.js @@ -22,8 +22,8 @@ var delayLoad = true; $scope.loaded = true; - if (!$rootScope.vaultLogins) { - $rootScope.vaultLogins = []; + if (!$rootScope.vaultCiphers) { + $rootScope.vaultCiphers = []; delayLoad = false; } if (!$rootScope.vaultFolders) { @@ -42,32 +42,30 @@ function loadVault() { var decFolders = []; - var decLogins = []; + var decCiphers = []; var promises = []; - var folderPromise = $q.when(folderService.getAllDecrypted()); - folderPromise.then(function (folders) { + var folderPromise = folderService.getAllDecrypted().then(function (folders) { decFolders = folders; }); promises.push(folderPromise); - var cipherPromise = loginService.getAllDecrypted(); - cipherPromise.then(function (ciphers) { - decLogins = ciphers; + var cipherPromise = loginService.getAllDecrypted().then(function (ciphers) { + decCiphers = ciphers; }); promises.push(cipherPromise); $q.all(promises).then(function () { $scope.loaded = true; $rootScope.vaultFolders = decFolders; - $rootScope.vaultLogins = decLogins; + $rootScope.vaultCiphers = decCiphers; if ($scope.showFolderCounts) { // compute item count for each folder for (var i = 0; i < decFolders.length; i++) { var itemCount = 0; - for (var j = 0; j < decLogins.length; j++) { - if (decLogins[j].folderId === decFolders[i].id) { + for (var j = 0; j < decCiphers.length; j++) { + if (decCiphers[j].folderId === decFolders[i].id) { itemCount++; } } @@ -95,30 +93,30 @@ return item.name.toLowerCase(); }; - $scope.searchLogins = function () { + $scope.searchCiphers = function () { if (!$scope.searchText || $scope.searchText.length < 2) { return; } - return searchLogin; + return searchCipher; }; - function searchLogin(login) { + function searchCipher(cipher) { var searchTerm = $scope.searchText.toLowerCase(); - if (login.name && login.name.toLowerCase().indexOf(searchTerm) !== -1) { + if (cipher.name && cipher.name.toLowerCase().indexOf(searchTerm) !== -1) { return true; } - if (login.username && login.username.toLowerCase().indexOf(searchTerm) !== -1) { + if (cipher.username && cipher.username.toLowerCase().indexOf(searchTerm) !== -1) { return true; } - if (login.uri && login.uri.toLowerCase().indexOf(searchTerm) !== -1) { + if (cipher.login && cipher.login.uri && cipher.login.uri.toLowerCase().indexOf(searchTerm) !== -1) { return true; } return false; } - $scope.addLogin = function () { + $scope.addCipher = function () { storeState(); $state.go('addLogin', { animation: 'in-slide-up', @@ -126,32 +124,32 @@ }); }; - $scope.viewLogin = function (login) { - if (login.clicked) { - login.cancelClick = true; - $scope.launchWebsite(login); + $scope.viewCipher = function (cipher) { + if (cipher.clicked) { + cipher.cancelClick = true; + $scope.launchWebsite(cipher); return; } - login.clicked = true; + cipher.clicked = true; $timeout(function () { - if (login.cancelClick) { - login.cancelClick = false; - login.clicked = false; + if (cipher.cancelClick) { + cipher.cancelClick = false; + cipher.clicked = false; return; } storeState(); $state.go('viewLogin', { - loginId: login.id, + loginId: cipher.id, animation: 'in-slide-up', from: 'vault' }); // clean up - login.cancelClick = false; - login.clicked = false; + cipher.cancelClick = false; + cipher.clicked = false; }, 200); }; @@ -173,11 +171,11 @@ toastr.info(type + i18nService.valueCopied); }; - $scope.launchWebsite = function (login) { + $scope.launchWebsite = function (cipher) { $timeout(function () { - if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) { + if (cipher.uri.startsWith('http://') || cipher.uri.startsWith('https://')) { $analytics.eventTrack('Launched Website From Listing'); - chrome.tabs.create({ url: login.uri }); + chrome.tabs.create({ url: cipher.uri }); if (utilsService.inPopup($window)) { $window.close(); } diff --git a/src/popup/app/vault/vaultViewFolderController.js b/src/popup/app/vault/vaultViewFolderController.js index 603c971872..34ea64f784 100644 --- a/src/popup/app/vault/vaultViewFolderController.js +++ b/src/popup/app/vault/vaultViewFolderController.js @@ -10,7 +10,7 @@ var pageSize = 100, decFolder = null, - decLogins = []; + decCiphers = []; $scope.folder = { id: !state.folderId || state.folderId === '0' ? null : state.folderId, @@ -20,8 +20,8 @@ $('#search').focus(); $scope.loaded = false; - $scope.vaultLogins = []; - $scope.pagedVaultLogins = []; + $scope.vaultCiphers = []; + $scope.pagedVaultCiphers = []; $scope.searchText = null; loadVault(); @@ -31,7 +31,7 @@ if ($scope.folder.id) { var folderDeferred = $q.defer(); folderService.get($scope.folder.id, function (folder) { - $q.when(folder.decrypt()).then(function (model) { + folder.decrypt().then(function (model) { decFolder = model; folderDeferred.resolve(); }); @@ -39,21 +39,20 @@ promises.push(folderDeferred.promise); } - var cipherPromise = loginService.getAllDecryptedForFolder($scope.folder.id); - cipherPromise.then(function (ciphers) { + var cipherPromise = loginService.getAllDecryptedForFolder($scope.folder.id).then(function (ciphers) { if (utilsService.isEdge()) { // Edge is super slow at sorting - decLogins = ciphers; + decCiphers = ciphers; } else { - decLogins = ciphers.sort(cipherSort); + decCiphers = ciphers.sort(cipherSort); } }); promises.push(cipherPromise); $q.all(promises).then(function () { $scope.loaded = true; - $scope.vaultLogins = decLogins; + $scope.vaultCiphers = decCiphers; if (decFolder) { $scope.folder.name = decFolder.name; @@ -61,7 +60,7 @@ if (state.searchText) { $scope.searchText = state.searchText; - $scope.searchLogins(); + $scope.searchCiphers(); } $timeout(setScrollY, 200); @@ -106,36 +105,36 @@ } $scope.loadMore = function () { - var pagedLength = $scope.pagedVaultLogins.length; - if ($scope.vaultLogins.length > pagedLength) { - $scope.pagedVaultLogins = - $scope.pagedVaultLogins.concat($scope.vaultLogins.slice(pagedLength, pagedLength + pageSize)); + var pagedLength = $scope.pagedVaultCiphers.length; + if ($scope.vaultCiphers.length > pagedLength) { + $scope.pagedVaultCiphers = + $scope.pagedVaultCiphers.concat($scope.vaultCiphers.slice(pagedLength, pagedLength + pageSize)); } }; - $scope.searchLogins = function () { + $scope.searchCiphers = function () { if (!$scope.searchText || $scope.searchText.length < 2) { - if ($scope.vaultLogins.length !== decLogins.length) { - resetList(decLogins); + if ($scope.vaultCiphers.length !== decCiphers.length) { + resetList(decCiphers); } return; } - var matchedLogins = []; - for (var i = 0; i < decLogins.length; i++) { - if (searchCipher(decLogins[i])) { - matchedLogins.push(decLogins[i]); + var matchedCiphers = []; + for (var i = 0; i < decCiphers.length; i++) { + if (searchCipher(decCiphers[i])) { + matchedCiphers.push(decCiphers[i]); } } - resetList(matchedLogins); + resetList(matchedCiphers); }; - $scope.launchWebsite = function (login) { + $scope.launchWebsite = function (cipher) { $timeout(function () { - if (login.uri.startsWith('http://') || login.uri.startsWith('https://')) { + if (cipher.uri.startsWith('http://') || cipher.uri.startsWith('https://')) { $analytics.eventTrack('Launched Website From Listing'); - chrome.tabs.create({ url: login.uri }); + chrome.tabs.create({ url: cipher.uri }); if (utilsService.inPopup($window)) { $window.close(); } @@ -143,9 +142,9 @@ }); }; - function resetList(logins) { - $scope.vaultLogins = logins; - $scope.pagedVaultLogins = []; + function resetList(ciphers) { + $scope.vaultCiphers = ciphers; + $scope.pagedVaultCiphers = []; $scope.loadMore(); } @@ -164,7 +163,7 @@ return false; } - $scope.addLogin = function () { + $scope.addCipher = function () { storeState(); $state.go('addLogin', { animation: 'in-slide-up', @@ -173,32 +172,32 @@ }); }; - $scope.viewLogin = function (login) { - if (login.clicked) { - login.cancelClick = true; - $scope.launchWebsite(login); + $scope.viewCipher = function (cipher) { + if (cipher.clicked) { + cipher.cancelClick = true; + $scope.launchWebsite(cipher); return; } - login.clicked = true; + cipher.clicked = true; $timeout(function () { - if (login.cancelClick) { - login.cancelClick = false; - login.clicked = false; + if (cipher.cancelClick) { + cipher.cancelClick = false; + cipher.clicked = false; return; } storeState(); $state.go('viewLogin', { - loginId: login.id, + loginId: cipher.id, animation: 'in-slide-up', from: 'folder' }); // clean up - login.cancelClick = false; - login.clicked = false; + cipher.cancelClick = false; + cipher.clicked = false; }, 200); }; diff --git a/src/popup/app/vault/views/vault.html b/src/popup/app/vault/views/vault.html index 3ceaae4e28..6c7b0b09d0 100644 --- a/src/popup/app/vault/views/vault.html +++ b/src/popup/app/vault/views/vault.html @@ -7,12 +7,12 @@