1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

value fixes

This commit is contained in:
Kyle Spearrin
2016-09-05 23:23:12 -04:00
parent 27667a3086
commit 1520f5e0df
2 changed files with 27 additions and 17 deletions

View File

@@ -21,9 +21,11 @@
id: folders[i].id
});
promises.push(decrypt(folders[j].name, i).then(function (obj) {
var folderNamePromise = decrypt(sites[i].name, i);
promises.push(folderNamePromise);
folderNamePromise.then(function (obj) {
decFolders[obj.index].name = obj.val;
}));
});
}
for (var j = 0; j < sites.length; j++) {
@@ -33,13 +35,17 @@
favorite: sites[j].favorite
});
promises.push(decrypt(sites[j].name, j).then(function (obj) {
var namePromise = decrypt(sites[j].name, j);
promises.push(namePromise);
namePromise.then(function (obj) {
decSites[obj.index].name = obj.val;
}));
});
promises.push(decrypt(sites[j].username, j).then(function (obj) {
var usernamePromise = decrypt(sites[j].username, j);
promises.push(usernamePromise);
usernamePromise.then(function (obj) {
decSites[obj.index].username = obj.val;
}));
});
}
$q.all(promises).then(function () {
@@ -50,13 +56,19 @@
});
function decrypt(cipherString, index) {
return $q(function(resolve, reject) {
return $q(function (resolve, reject) {
if (!cipherString) {
resolve({val: null, index: index});
resolve({
val: null,
index: index
});
}
else {
cipherString.decrypt(function (decString) {
resolve({ val: decString, index: index });
resolve({
val: decString,
index: index
});
});
}
});