Conditions | 1 |
Paths | 1 |
Total Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | // Importers should always start with this |
||
3 | (function(window, $, PassmanImporter) { |
||
4 | 'use strict'; |
||
5 | // Define the importer |
||
6 | PassmanImporter.lastpassCsv = { |
||
7 | info: { |
||
8 | name: 'LastPass csv', |
||
9 | id: 'lastpassCsv', |
||
10 | description: 'Create an csv export. Go to More options -> Advanced -> Export -> Last Pass CSV File' |
||
11 | } |
||
12 | }; |
||
13 | |||
14 | PassmanImporter.lastpassCsv.readFile = function (file_data) { |
||
15 | return new C_Promise(function(){ |
||
16 | var parsed_csv = PassmanImporter.readCsv(file_data); |
||
17 | var credential_list = []; |
||
18 | for (var i = 0; i < parsed_csv.length; i++) { |
||
19 | var row = parsed_csv[i]; |
||
20 | var _credential = PassmanImporter.newCredential(); |
||
21 | _credential.label = PassmanImporter.htmlDecode(row.name); |
||
22 | _credential.username = row.username; |
||
23 | _credential.password = row.password; |
||
24 | _credential.url = row.url; |
||
25 | _credential.tags = [{text: row.grouping}]; |
||
26 | _credential.description = row.extra; |
||
27 | if(_credential.label){ |
||
28 | credential_list.push(_credential); |
||
29 | } |
||
30 | var progress = { |
||
31 | percent: i/parsed_csv.length*100, |
||
32 | loaded: i, |
||
33 | total: parsed_csv.length |
||
34 | }; |
||
35 | this.call_progress(progress); |
||
36 | } |
||
37 | this.call_then(credential_list) |
||
38 | }); |
||
39 | }; |
||
40 | })(window, $, PassmanImporter); |