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
|
notes: encryptedLogin.Notes && encryptedLogin.Notes !== '' ? cryptoService.decrypt(encryptedLogin.Notes, key) : null
|
||||||
};
|
};
|
||||||
|
|
||||||
if (encryptedLogin.Folder) {
|
|
||||||
login.folder = {
|
|
||||||
name: cryptoService.decrypt(encryptedLogin.Folder.Name)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return login;
|
return login;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,19 +5,40 @@
|
||||||
$analytics.eventTrack('toolsExportController', { category: 'Modal' });
|
$analytics.eventTrack('toolsExportController', { category: 'Modal' });
|
||||||
$scope.export = function (model) {
|
$scope.export = function (model) {
|
||||||
$scope.startedExport = true;
|
$scope.startedExport = true;
|
||||||
apiService.logins.list({ expand: ['folder'] }, function (logins) {
|
var decLogins = [],
|
||||||
try {
|
decFolders = [];
|
||||||
var decLogins = cipherService.decryptLogins(logins.Data);
|
|
||||||
|
|
||||||
|
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 = [];
|
var exportLogins = [];
|
||||||
for (var i = 0; i < decLogins.length; i++) {
|
for (i = 0; i < decLogins.length; i++) {
|
||||||
var login = {
|
var login = {
|
||||||
name: decLogins[i].name,
|
name: decLogins[i].name,
|
||||||
uri: decLogins[i].uri,
|
uri: decLogins[i].uri,
|
||||||
username: decLogins[i].username,
|
username: decLogins[i].username,
|
||||||
password: decLogins[i].password,
|
password: decLogins[i].password,
|
||||||
notes: decLogins[i].notes,
|
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
|
favorite: decLogins[i].favorite ? 1 : null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue