mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-02 08:40:08 +01:00
logmeonce csv importer
This commit is contained in:
parent
fbc7d6c2bc
commit
99d56d936f
31
src/importers/logMeOnceCsvImporter.ts
Normal file
31
src/importers/logMeOnceCsvImporter.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { BaseImporter } from './baseImporter';
|
||||
import { Importer } from './importer';
|
||||
|
||||
import { ImportResult } from '../models/domain/importResult';
|
||||
|
||||
export class LogMeOnceCsvImporter extends BaseImporter implements Importer {
|
||||
parse(data: string): ImportResult {
|
||||
const result = new ImportResult();
|
||||
const results = this.parseCsv(data, false);
|
||||
if (results == null) {
|
||||
result.success = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
results.forEach((value) => {
|
||||
if (value.length < 4) {
|
||||
return;
|
||||
}
|
||||
const cipher = this.initLoginCipher();
|
||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
||||
cipher.login.username = this.getValueOrDefault(value[2]);
|
||||
cipher.login.password = this.getValueOrDefault(value[3]);
|
||||
cipher.login.uris = this.makeUriArray(value[1]);
|
||||
this.cleanupCipher(cipher);
|
||||
result.ciphers.push(cipher);
|
||||
});
|
||||
|
||||
result.success = true;
|
||||
return result;
|
||||
}
|
||||
}
|
@ -43,6 +43,7 @@ import { KeePass2XmlImporter } from '../importers/keepass2XmlImporter';
|
||||
import { KeePassXCsvImporter } from '../importers/keepassxCsvImporter';
|
||||
import { KeeperCsvImporter } from '../importers/keeperCsvImporter';
|
||||
import { LastPassCsvImporter } from '../importers/lastpassCsvImporter';
|
||||
import { LogMeOnceCsvImporter } from '../importers/logMeOnceCsvImporter';
|
||||
import { MeldiumCsvImporter } from '../importers/meldiumCsvImporter';
|
||||
import { MSecureCsvImporter } from '../importers/msecureCsvImporter';
|
||||
import { MykiCsvImporter } from '../importers/mykiCsvImporter';
|
||||
@ -119,6 +120,7 @@ export class ImportService implements ImportServiceAbstraction {
|
||||
{ id: 'passwordwallettxt', name: 'PasswordWallet (txt)' },
|
||||
{ id: 'mykicsv', name: 'Myki (csv)' },
|
||||
{ id: 'securesafecsv', name: 'SecureSafe (csv)' },
|
||||
{ id: 'logmeoncecsv', name: 'LogMeOnce (csv)' },
|
||||
];
|
||||
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||
@ -255,6 +257,8 @@ export class ImportService implements ImportServiceAbstraction {
|
||||
return new MykiCsvImporter();
|
||||
case 'securesafecsv':
|
||||
return new SecureSafeCsvImporter();
|
||||
case 'logmeoncecsv':
|
||||
return new LogMeOnceCsvImporter();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user