1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-10-04 05:08:06 +02:00

Handle empty password and uri fields when encrypting/decrypting

This commit is contained in:
Kyle Spearrin 2016-10-12 22:26:28 -04:00
parent 85efba92e6
commit 2ce1b12f6e
2 changed files with 7 additions and 4 deletions

View File

@ -24,9 +24,9 @@ angular
folderId: encryptedSite.FolderId, folderId: encryptedSite.FolderId,
favorite: encryptedSite.Favorite, favorite: encryptedSite.Favorite,
name: cryptoService.decrypt(encryptedSite.Name), name: cryptoService.decrypt(encryptedSite.Name),
uri: cryptoService.decrypt(encryptedSite.Uri), uri: encryptedSite.Uri && encryptedSite.Uri !== '' ? cryptoService.decrypt(encryptedSite.Uri) : null,
username: encryptedSite.Username && encryptedSite.Username !== '' ? cryptoService.decrypt(encryptedSite.Username) : null, username: encryptedSite.Username && encryptedSite.Username !== '' ? cryptoService.decrypt(encryptedSite.Username) : null,
password: cryptoService.decrypt(encryptedSite.Password), password: encryptedSite.Password && encryptedSite.Password !== '' ? cryptoService.decrypt(encryptedSite.Password) : null,
notes: encryptedSite.Notes && encryptedSite.Notes !== '' ? cryptoService.decrypt(encryptedSite.Notes) : null notes: encryptedSite.Notes && encryptedSite.Notes !== '' ? cryptoService.decrypt(encryptedSite.Notes) : null
}; };
@ -79,10 +79,10 @@ angular
'type': 1, 'type': 1,
folderId: unencryptedSite.folderId === '' ? null : unencryptedSite.folderId, folderId: unencryptedSite.folderId === '' ? null : unencryptedSite.folderId,
favorite: unencryptedSite.favorite !== null ? unencryptedSite.favorite : false, favorite: unencryptedSite.favorite !== null ? unencryptedSite.favorite : false,
uri: cryptoService.encrypt(unencryptedSite.uri, key), uri: !unencryptedSite.uri || unencryptedSite.uri === '' ? null : cryptoService.encrypt(unencryptedSite.uri, key),
name: cryptoService.encrypt(unencryptedSite.name, key), name: cryptoService.encrypt(unencryptedSite.name, key),
username: !unencryptedSite.username || unencryptedSite.username === '' ? null : cryptoService.encrypt(unencryptedSite.username, key), username: !unencryptedSite.username || unencryptedSite.username === '' ? null : cryptoService.encrypt(unencryptedSite.username, key),
password: cryptoService.encrypt(unencryptedSite.password, key), password: !unencryptedSite.password || unencryptedSite.password === '' ? null : cryptoService.encrypt(unencryptedSite.password, key),
notes: !unencryptedSite.notes || unencryptedSite.notes === '' ? null : cryptoService.encrypt(unencryptedSite.notes, key) notes: !unencryptedSite.notes || unencryptedSite.notes === '' ? null : cryptoService.encrypt(unencryptedSite.notes, key)
}; };
}; };

View File

@ -181,6 +181,9 @@
success(folders, sites, siteRelationships); success(folders, sites, siteRelationships);
} }
} }
else {
error();
}
}; };
reader.onerror = function (evt) { reader.onerror = function (evt) {