mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-24 16:49:26 +01:00
export data fixes due to api cahnges
This commit is contained in:
parent
0591f106d3
commit
da8b31533a
@ -37,12 +37,6 @@ angular
|
||||
notes: encryptedLogin.Notes && encryptedLogin.Notes !== '' ? cryptoService.decrypt(encryptedLogin.Notes, key) : null
|
||||
};
|
||||
|
||||
if (encryptedLogin.Folder) {
|
||||
login.folder = {
|
||||
name: cryptoService.decrypt(encryptedLogin.Folder.Name)
|
||||
};
|
||||
}
|
||||
|
||||
return login;
|
||||
};
|
||||
|
||||
|
@ -5,19 +5,40 @@
|
||||
$analytics.eventTrack('toolsExportController', { category: 'Modal' });
|
||||
$scope.export = function (model) {
|
||||
$scope.startedExport = true;
|
||||
apiService.logins.list({ expand: ['folder'] }, function (logins) {
|
||||
try {
|
||||
var decLogins = cipherService.decryptLogins(logins.Data);
|
||||
var decLogins = [],
|
||||
decFolders = [];
|
||||
|
||||
var folderPromise = apiService.folders.list({}, function (folders) {
|
||||
decFolders = cipherService.decryptFolders(folders.Data);
|
||||
}).$promise;
|
||||
|
||||
var loginsPromise = apiService.logins.list({}, function (logins) {
|
||||
decLogins = cipherService.decryptLogins(logins.Data);
|
||||
}).$promise;
|
||||
|
||||
$q.all([folderPromise, loginsPromise]).then(function () {
|
||||
if (!decLogins.length) {
|
||||
toastr.error('Nothing to export.', 'Error!');
|
||||
$scope.close();
|
||||
return;
|
||||
}
|
||||
|
||||
var foldersDict = {};
|
||||
for (var i = 0; i < decFolders.length; i++) {
|
||||
foldersDict[decFolders[i].id] = decFolders[i];
|
||||
}
|
||||
|
||||
try {
|
||||
var exportLogins = [];
|
||||
for (var i = 0; i < decLogins.length; i++) {
|
||||
for (i = 0; i < decLogins.length; i++) {
|
||||
var login = {
|
||||
name: decLogins[i].name,
|
||||
uri: decLogins[i].uri,
|
||||
username: decLogins[i].username,
|
||||
password: decLogins[i].password,
|
||||
notes: decLogins[i].notes,
|
||||
folder: decLogins[i].folder ? decLogins[i].folder.name : null,
|
||||
folder: decLogins[i].folderId && (decLogins[i].folderId in foldersDict) ?
|
||||
foldersDict[decLogins[i].folderId].name : null,
|
||||
favorite: decLogins[i].favorite ? 1 : null
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user