mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-25 16:59:17 +01:00
adds support for yoti csv importer (#157)
This commit is contained in:
parent
6ab444a986
commit
e55528e617
28
src/importers/yotiCsvImporter.ts
Normal file
28
src/importers/yotiCsvImporter.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { BaseImporter } from './baseImporter';
|
||||
import { Importer } from './importer';
|
||||
|
||||
import { ImportResult } from '../models/domain/importResult';
|
||||
|
||||
export class YotiCsvImporter extends BaseImporter implements Importer {
|
||||
parse(data: string): ImportResult {
|
||||
const result = new ImportResult();
|
||||
const results = this.parseCsv(data, true);
|
||||
if (results == null) {
|
||||
result.success = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
results.forEach((value) => {
|
||||
const cipher = this.initLoginCipher();
|
||||
cipher.name = this.getValueOrDefault(value.Name, '--');
|
||||
cipher.login.username = this.getValueOrDefault(value['User name']);
|
||||
cipher.login.password = this.getValueOrDefault(value.Password);
|
||||
cipher.login.uris = this.makeUriArray(value.URL);
|
||||
this.cleanupCipher(cipher);
|
||||
result.ciphers.push(cipher);
|
||||
});
|
||||
|
||||
result.success = true;
|
||||
return result;
|
||||
}
|
||||
}
|
@ -72,6 +72,7 @@ import { SplashIdCsvImporter } from '../importers/splashIdCsvImporter';
|
||||
import { StickyPasswordXmlImporter } from '../importers/stickyPasswordXmlImporter';
|
||||
import { TrueKeyCsvImporter } from '../importers/truekeyCsvImporter';
|
||||
import { UpmCsvImporter } from '../importers/upmCsvImporter';
|
||||
import { YotiCsvImporter } from '../importers/yotiCsvImporter';
|
||||
import { ZohoVaultCsvImporter } from '../importers/zohoVaultCsvImporter';
|
||||
|
||||
export class ImportService implements ImportServiceAbstraction {
|
||||
@ -131,6 +132,7 @@ export class ImportService implements ImportServiceAbstraction {
|
||||
{ id: 'buttercupcsv', name: 'Buttercup (csv)' },
|
||||
{ id: 'codebookcsv', name: 'Codebook (csv)' },
|
||||
{ id: 'encryptrcsv', name: 'Encryptr (csv)' },
|
||||
{ id: 'yoticsv', name: 'Yoti (csv)' },
|
||||
];
|
||||
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||
@ -279,6 +281,8 @@ export class ImportService implements ImportServiceAbstraction {
|
||||
return new CodebookCsvImporter();
|
||||
case 'encryptrcsv':
|
||||
return new EncryptrCsvImporter();
|
||||
case 'yoticsv':
|
||||
return new YotiCsvImporter();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user