1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00

vault listing page fixes

This commit is contained in:
Kyle Spearrin
2017-10-13 23:11:42 -04:00
parent b5c70c4941
commit 5a1bf8299f
9 changed files with 71 additions and 54 deletions

View File

@@ -182,7 +182,7 @@ function initLoginService() {
key = null,
localData = null;
self.userService.getUserIdPromise().then(function (userId) {
return self.userService.getUserIdPromise().then(function (userId) {
key = 'ciphers_' + userId;
return self.utilsService.getObjFromStorage(self.localDataKey);
}).then(function (data) {
@@ -191,11 +191,11 @@ function initLoginService() {
localData = {};
}
return self.utilsService.getObjFromStorage(key);
}).then(function (logins) {
}).then(function (ciphers) {
var response = [];
for (var id in logins) {
for (var id in ciphers) {
if (id) {
response.push(new Login(logins[id], false, localData[id]));
response.push(new Cipher(ciphers[id], false, localData[id]));
}
}
@@ -205,7 +205,7 @@ function initLoginService() {
LoginService.prototype.getAllDecrypted = function () {
var self = this,
decLogins = [];
decCiphers = [];
return self.cryptoService.getKey().then(function (key) {
if (!key) {
@@ -219,19 +219,19 @@ function initLoginService() {
}
return self.getAll();
}).then(function (logins) {
}).then(function (ciphers) {
var promises = [];
for (var i = 0; i < logins.length; i++) {
for (var i = 0; i < ciphers.length; i++) {
/* jshint ignore:start */
promises.push(logins[i].decrypt().then(function (login) {
decLogins.push(login);
promises.push(ciphers[i].decrypt().then(function (cipher) {
decCiphers.push(cipher);
}));
/* jshint ignore:end */
}
return Q.all(promises);
}).then(function () {
self.decryptedCipherCache = decLogins;
self.decryptedCipherCache = decCiphers;
return self.decryptedCipherCache;
});
};

View File

@@ -139,14 +139,11 @@ function initSyncService() {
}
function syncCiphers(self, userId, response) {
var logins = {};
var ciphers = {};
for (var i = 0; i < response.length; i++) {
var data = response[i];
if (data.type === 1) {
logins[data.id] = new LoginData(data, userId);
}
ciphers[response[i].id] = new CipherData(response[i], userId);
}
return self.loginService.replace(logins);
return self.loginService.replace(ciphers);
}
function syncSettings(self, userId, response) {