mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-13 00:51:45 +01:00
make enpass checks ignore case
This commit is contained in:
parent
3bc81ca450
commit
4927d0d907
@ -20,7 +20,7 @@ export class EnpassCsvImporter extends BaseImporter implements Importer {
|
|||||||
|
|
||||||
let firstRow = true;
|
let firstRow = true;
|
||||||
results.forEach((value) => {
|
results.forEach((value) => {
|
||||||
if (value.length < 2 || (firstRow && value[0] === 'Title')) {
|
if (value.length < 2 || (firstRow && (value[0] === 'Title' || value[0] === 'title'))) {
|
||||||
firstRow = false;
|
firstRow = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -29,14 +29,16 @@ export class EnpassCsvImporter extends BaseImporter implements Importer {
|
|||||||
cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
cipher.notes = this.getValueOrDefault(value[value.length - 1]);
|
||||||
cipher.name = this.getValueOrDefault(value[0], '--');
|
cipher.name = this.getValueOrDefault(value[0], '--');
|
||||||
|
|
||||||
if (value.length === 2 || (value.indexOf('Username') < 0 && value.indexOf('Password') < 0 &&
|
if (value.length === 2 || (!this.containsField(value, 'username') &&
|
||||||
value.indexOf('Email') && value.indexOf('URL') < 0)) {
|
!this.containsField(value, 'password') && !this.containsField(value, 'email') &&
|
||||||
|
!this.containsField(value, 'url'))) {
|
||||||
cipher.type = CipherType.SecureNote;
|
cipher.type = CipherType.SecureNote;
|
||||||
cipher.secureNote = new SecureNoteView();
|
cipher.secureNote = new SecureNoteView();
|
||||||
cipher.secureNote.type = SecureNoteType.Generic;
|
cipher.secureNote.type = SecureNoteType.Generic;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.indexOf('Cardholder') > -1 && value.indexOf('Number') > -1 && value.indexOf('Expiry date') > -1) {
|
if (this.containsField(value, 'cardholder') && this.containsField(value, 'number') &&
|
||||||
|
this.containsField(value, 'expiry date')) {
|
||||||
cipher.type = CipherType.Card;
|
cipher.type = CipherType.Card;
|
||||||
cipher.card = new CardView();
|
cipher.card = new CardView();
|
||||||
}
|
}
|
||||||
@ -115,4 +117,12 @@ export class EnpassCsvImporter extends BaseImporter implements Importer {
|
|||||||
result.success = true;
|
result.success = true;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private containsField(fields: any[], name: string) {
|
||||||
|
if (fields == null || name == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return fields.filter((f) => !this.isNullOrWhitespace(f) &&
|
||||||
|
f.toLowerCase() === name.toLowerCase()).length > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user