avast passwords csv importer
This commit is contained in:
parent
58ed2ed0a2
commit
af4e01c238
|
@ -0,0 +1,28 @@
|
|||
import { BaseImporter } from './baseImporter';
|
||||
import { Importer } from './importer';
|
||||
|
||||
import { ImportResult } from '../models/domain/importResult';
|
||||
|
||||
export class AvastCsvImporter 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.uris = this.makeUriArray(value.web);
|
||||
cipher.login.password = this.getValueOrDefault(value.password);
|
||||
cipher.login.username = this.getValueOrDefault(value.login);
|
||||
this.cleanupCipher(cipher);
|
||||
result.ciphers.push(cipher);
|
||||
});
|
||||
|
||||
result.success = true;
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@ import { KvpRequest } from '../models/request/kvpRequest';
|
|||
import { CipherView } from '../models/view/cipherView';
|
||||
|
||||
import { AscendoCsvImporter } from '../importers/ascendoCsvImporter';
|
||||
import { AvastCsvImporter } from '../importers/avastCsvImporter';
|
||||
import { AviraCsvImporter } from '../importers/aviraCsvImporter';
|
||||
import { BitwardenCsvImporter } from '../importers/bitwardenCsvImporter';
|
||||
import { BitwardenJsonImporter } from '../importers/bitwardenJsonImporter';
|
||||
|
@ -101,6 +102,7 @@ export class ImportService implements ImportServiceAbstraction {
|
|||
{ id: 'passwordagentcsv', name: 'Password Agent (csv)' },
|
||||
{ id: 'passpackcsv', name: 'Passpack (csv)' },
|
||||
{ id: 'passmanjson', name: 'Passman (json)' },
|
||||
{ id: 'avastcsv', name: 'Avast Passwords (csv)' },
|
||||
];
|
||||
|
||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||
|
@ -223,6 +225,8 @@ export class ImportService implements ImportServiceAbstraction {
|
|||
return new PasspackCsvImporter();
|
||||
case 'passmanjson':
|
||||
return new PassmanJsonImporter();
|
||||
case 'avastcsv':
|
||||
return new AvastCsvImporter();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue