From ac6a3caa8ffc0508e626260146be82af94f99d0c Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 4 Jan 2017 00:11:27 -0500 Subject: [PATCH] importer instructions --- src/app/services/importService.js | 42 ++------ src/app/tools/toolsController.js | 3 +- src/app/tools/toolsImportController.js | 127 ++++++++++++++++++++++++- src/app/tools/views/toolsImport.html | 34 ++----- src/less/vault.less | 17 ++++ 5 files changed, 155 insertions(+), 68 deletions(-) diff --git a/src/app/services/importService.js b/src/app/services/importService.js index 50aadbc311..688c37026d 100644 --- a/src/app/services/importService.js +++ b/src/app/services/importService.js @@ -11,20 +11,17 @@ } switch (source) { - case 'local': - importLocal(file, success, error); + case 'bitwardencsv': + importBitwardenCsv(file, success, error); break; case 'lastpass': importLastPass(file, success, error); break; - case 'safeincloudcsv': - importSafeInCloudCsv(file, success, error); - break; case 'safeincloudxml': importSafeInCloudXml(file, success, error); break; - case 'keepassxml': - importKeePassXml(file, success, error); + case 'keepass2xml': + importKeePass2Xml(file, success, error); break; case 'keepassxcsv': importKeePassXCsv(file, success, error); @@ -182,7 +179,7 @@ } } - function importLocal(file, success, error) { + function importBitwardenCsv(file, success, error) { Papa.parse(file, { header: true, encoding: 'UTF-8', @@ -340,33 +337,6 @@ } } - function importSafeInCloudCsv(file, success, error) { - Papa.parse(file, { - header: true, - encoding: 'UTF-8', - complete: function (results) { - parseCsvErrors(results); - - var folders = [], - logins = [], - loginRelationships = []; - - angular.forEach(results.data, function (value, key) { - logins.push({ - favorite: false, - uri: value.URL && value.URL !== '' ? trimUri(value.URL) : null, - username: value.Login && value.Login !== '' ? value.Login : null, - password: value.Password && value.Password !== '' ? value.Password : null, - notes: value.Notes && value.Notes !== '' ? value.Notes : null, - name: value.Title && value.Title !== '' ? value.Title : '--', - }); - }); - - success(folders, logins, loginRelationships); - } - }); - } - function importSafeInCloudXml(file, success, error) { var folders = [], logins = [], @@ -557,7 +527,7 @@ }); } - function importKeePassXml(file, success, error) { + function importKeePass2Xml(file, success, error) { var folders = [], logins = [], loginRelationships = []; diff --git a/src/app/tools/toolsController.js b/src/app/tools/toolsController.js index 833a1e44a0..644e097f6d 100644 --- a/src/app/tools/toolsController.js +++ b/src/app/tools/toolsController.js @@ -6,8 +6,7 @@ $uibModal.open({ animation: true, templateUrl: 'app/tools/views/toolsImport.html', - controller: 'toolsImportController', - size: 'sm' + controller: 'toolsImportController' }); }; diff --git a/src/app/tools/toolsImportController.js b/src/app/tools/toolsImportController.js index 11c117cbe8..b09fd2d47f 100644 --- a/src/app/tools/toolsImportController.js +++ b/src/app/tools/toolsImportController.js @@ -1,9 +1,132 @@ angular .module('bit.tools') - .controller('toolsImportController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, cipherService, toastr, importService, $analytics) { + .controller('toolsImportController', function ($scope, $state, apiService, $uibModalInstance, cryptoService, cipherService, toastr, importService, $analytics, $sce) { $analytics.eventTrack('toolsImportController', { category: 'Modal' }); - $scope.model = { source: 'local' }; + $scope.model = { source: 'bitwardencsv' }; + $scope.source = {}; + + $scope.options = [ + { + id: 'bitwardencsv', + name: 'bitwarden (csv)', + instructions: $sce.trustAsHtml('Export using the web vault (vault.bitwarden.com). ' + + 'Log into the web vault and navigate to "Tools" > "Export".') + }, + { + id: 'lastpass', + name: 'LastPass (csv)', + instructions: $sce.trustAsHtml('See detailed instructions on our help site at ' + + '' + + 'https://help.bitwarden.com/getting-started/import-from-lastpass/') + }, + { + id: 'chromecsv', + name: 'Chrome (csv)', + instructions: $sce.trustAsHtml('See detailed instructions on our help site at ' + + '' + + 'https://help.bitwarden.com/getting-started/import-from-chrome/') + }, + { + id: 'firefoxpasswordexportercsvxml', + name: 'Firefox Password Exporter (xml)', + instructions: $sce.trustAsHtml('Use the ' + + '' + + 'Password Exporter addon for FireFox to export your passwords to an XML file.') + }, + { + id: 'keepass2xml', + name: 'KeePass 2 (xml)', + instructions: $sce.trustAsHtml('Using the KeePass 2 desktop application, navigate to "File" > "Export" and ' + + 'select the KeePass XML (2.x) option.') + }, + { + id: 'keepassxcsv', + name: 'KeePassX (csv)', + instructions: $sce.trustAsHtml('Using the KeePassX desktop application, navigate to "Database" > ' + + '"Export to CSV file" and save the CSV file.') + }, + { + id: 'dashlanecsv', + name: 'Dashlane (csv)', + instructions: $sce.trustAsHtml('Using the Dashlane desktop application, navigate to "File" > "Export" > ' + + '"Unsecured archive (readable) in CSV format" and save the CSV file.') + }, + { + id: '1password41pif', + name: '1Password 4 (1pif)', + instructions: $sce.trustAsHtml('See detailed instructions on our help site at ' + + '' + + 'https://help.bitwarden.com/getting-started/import-from-1password/') + }, + { + id: '1password6csv', + name: '1Password 6 (csv)', + instructions: $sce.trustAsHtml('See detailed instructions on our help site at ' + + '' + + 'https://help.bitwarden.com/getting-started/import-from-1password/') + }, + { + id: 'roboformhtml', + name: 'RoboForm (html)', + instructions: $sce.trustAsHtml('Using the RoboForm Editor desktop application, navigate to "RoboForm" ' + + '(top left) > "Print List" > "Logins". When the following print dialog pops up click on the "Save" button ' + + 'and save the HTML file.') + }, + { + id: 'keepercsv', + name: 'Keeper (csv)', + instructions: $sce.trustAsHtml('Log into the Keeper web vault (keepersecurity.com/vault). Navigate to "Backup" ' + + '(top right) and find the "Export to Text File" option. Click "Export Now" to save the TXT/CSV file.') + }, + { + id: 'enpasscsv', + name: 'Enpass (csv)', + instructions: $sce.trustAsHtml('Using the Enpass desktop application, navigate to "File" > "Export" > ' + + '"As CSV". Select "Yes" to the warning alert and save the CSV file.') + }, + { + id: 'safeincloudxml', + name: 'SafeInCloud (xml)', + instructions: $sce.trustAsHtml('Using the SaveInCloud desktop application, navigate to "File" > "Export" > ' + + '"As XML" and save the XML file.') + }, + { + id: 'pwsafexml', + name: 'Password Safe (xml)', + instructions: $sce.trustAsHtml('Using the Password Safe desktop application, navigate to "File" > ' + + '"Export To" > "XML format..." and save the XML file.') + }, + { + id: 'stickypasswordxml', + name: 'Sticky Password (xml)', + instructions: $sce.trustAsHtml('Using the Sticky Password desktop application, navigate to "Menu" ' + + '(top right) > "Export" > "Export all". Select the unencrypted format XML option and then the ' + + '"Save to file" button. Save the XML file.') + }, + { + id: 'msecurecsv', + name: 'mSecure (csv)', + instructions: $sce.trustAsHtml('Using the mSecure desktop application, navigate to "File" > ' + + '"Export" > "CSV File..." and save the CSV file.') + }, + { + id: 'truekeyjson', + name: 'True Key (json)', + instructions: $sce.trustAsHtml('Using the True Key desktop application, click the gear icon (top right) and ' + + 'then navigate to "App Settings". Click the "Export" button and save the JSON file.') + } + ]; + + $scope.setSource = function () { + for (var i = 0; i < $scope.options.length; i++) { + if ($scope.options[i].id === $scope.model.source) { + $scope.source = $scope.options[i]; + break; + } + } + }; + $scope.setSource(); $scope.import = function (model) { $scope.processing = true; diff --git a/src/app/tools/views/toolsImport.html b/src/app/tools/views/toolsImport.html index 7d632b7048..81e6e1de3f 100644 --- a/src/app/tools/views/toolsImport.html +++ b/src/app/tools/views/toolsImport.html @@ -6,36 +6,14 @@