1
0
mirror of https://github.com/bitwarden/web synced 2025-12-10 21:33:16 +00:00

org import from lastpass

This commit is contained in:
Kyle Spearrin
2017-09-06 10:50:05 -04:00
parent aaa91e50b7
commit 2b6d7ec361
2 changed files with 16 additions and 4 deletions

View File

@@ -17,6 +17,15 @@
instructions: $sce.trustAsHtml('Export using the web vault (vault.bitwarden.com). ' + instructions: $sce.trustAsHtml('Export using the web vault (vault.bitwarden.com). ' +
'Log into the web vault and navigate to your organization\'s admin area. Then to go ' + 'Log into the web vault and navigate to your organization\'s admin area. Then to go ' +
'"Settings" > "Tools" > "Export".') '"Settings" > "Tools" > "Export".')
},
{
id: 'lastpass',
name: 'LastPass (csv)',
featured: true,
sort: 2,
instructions: $sce.trustAsHtml('See detailed instructions on our help site at ' +
'<a target="_blank" href="https://help.bitwarden.com/article/import-from-lastpass/">' +
'https://help.bitwarden.com/article/import-from-lastpass/</a>')
} }
]; ];
@@ -66,7 +75,7 @@
collectionRelationships: collectionRelationships collectionRelationships: collectionRelationships
}, function () { }, function () {
$uibModalInstance.dismiss('cancel'); $uibModalInstance.dismiss('cancel');
$state.go('backend.user.vault', { refreshFromServer: true }).then(function () { $state.go('backend.org.vault', { orgId: $state.params.orgId }).then(function () {
$analytics.eventTrack('Imported Org Data', { label: $scope.model.source }); $analytics.eventTrack('Imported Org Data', { label: $scope.model.source });
toastr.success('Data has been successfully imported into your vault.', 'Import Success'); toastr.success('Data has been successfully imported into your vault.', 'Import Success');
}); });

View File

@@ -15,7 +15,7 @@
importBitwardenCsv(file, success, error); importBitwardenCsv(file, success, error);
break; break;
case 'lastpass': case 'lastpass':
importLastPass(file, success, error); importLastPass(file, success, error, false);
break; break;
case 'safeincloudxml': case 'safeincloudxml':
importSafeInCloudXml(file, success, error); importSafeInCloudXml(file, success, error);
@@ -119,6 +119,9 @@
case 'bitwardencsv': case 'bitwardencsv':
importBitwardenOrgCsv(file, success, error); importBitwardenOrgCsv(file, success, error);
break; break;
case 'lastpass':
importLastPass(file, success, error, true);
break;
default: default:
error(); error();
break; break;
@@ -346,7 +349,7 @@
}); });
} }
function importLastPass(file, success, error) { function importLastPass(file, success, error, org) {
if (typeof file !== 'string' && file.type && file.type === 'text/html') { if (typeof file !== 'string' && file.type && file.type === 'text/html') {
var reader = new FileReader(); var reader = new FileReader();
reader.readAsText(file, 'utf-8'); reader.readAsText(file, 'utf-8');
@@ -424,7 +427,7 @@
} }
logins.push({ logins.push({
favorite: value.fav === '1', favorite: org ? false : value.fav === '1',
uri: value.url && value.url !== '' ? trimUri(value.url) : null, uri: value.url && value.url !== '' ? trimUri(value.url) : null,
username: value.username && value.username !== '' ? value.username : null, username: value.username && value.username !== '' ? value.username : null,
password: value.password && value.password !== '' ? value.password : null, password: value.password && value.password !== '' ? value.password : null,