mirror of
https://github.com/bitwarden/browser
synced 2025-12-29 06:33:40 +00:00
1password 1pif importer: create hidden fields (#32)
* allow base importer to receive custom field type * 1password importer uses hidden field type for custom fields marked as 'concealed' * 1password 1pif importer specs * remove 'focus' from specs * change field type logic into simple one liner
This commit is contained in:
committed by
Kyle Spearrin
parent
593870e936
commit
f874ec253d
@@ -302,7 +302,7 @@ export abstract class BaseImporter {
|
||||
}
|
||||
}
|
||||
|
||||
protected processKvp(cipher: CipherView, key: string, value: string) {
|
||||
protected processKvp(cipher: CipherView, key: string, value: string, type: FieldType = FieldType.Text) {
|
||||
if (this.isNullOrWhitespace(value)) {
|
||||
return;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ export abstract class BaseImporter {
|
||||
cipher.fields = [];
|
||||
}
|
||||
const field = new FieldView();
|
||||
field.type = FieldType.Text;
|
||||
field.type = type;
|
||||
field.name = key;
|
||||
field.value = value;
|
||||
cipher.fields.push(field);
|
||||
|
||||
@@ -8,6 +8,7 @@ import { CipherView } from '../models/view/cipherView';
|
||||
import { SecureNoteView } from '../models/view/secureNoteView';
|
||||
|
||||
import { CipherType } from '../enums/cipherType';
|
||||
import { FieldType } from '../enums/fieldType';
|
||||
import { SecureNoteType } from '../enums/secureNoteType';
|
||||
|
||||
export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
||||
@@ -168,8 +169,9 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
|
||||
}
|
||||
}
|
||||
|
||||
const fieldType = (field.k === 'concealed') ? FieldType.Hidden : FieldType.Text;
|
||||
const fieldName = this.isNullOrWhitespace(field[nameKey]) ? 'no_name' : field[nameKey];
|
||||
this.processKvp(cipher, fieldName, fieldValue);
|
||||
this.processKvp(cipher, fieldName, fieldValue, fieldType);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user