mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +01:00
[PM-9318] Fix username on protonpass import (#9889)
* Fix username field used for ProtonPass import ProtonPass has changed their export format and userName is not itemEmail * Import additional field itemUsername --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
6b122ca123
commit
83a32cd179
@ -31,9 +31,12 @@ describe("Protonpass Json Importer", () => {
|
||||
expect(uriView.uri).toEqual("https://example.com/");
|
||||
expect(cipher.notes).toEqual("My login secure note.");
|
||||
|
||||
expect(cipher.fields.at(2).name).toEqual("second 2fa secret");
|
||||
expect(cipher.fields.at(2).value).toEqual("TOTPCODE");
|
||||
expect(cipher.fields.at(2).type).toEqual(FieldType.Hidden);
|
||||
expect(cipher.fields.at(0).name).toEqual("itemUsername");
|
||||
expect(cipher.fields.at(0).value).toEqual("someOtherUsername");
|
||||
|
||||
expect(cipher.fields.at(3).name).toEqual("second 2fa secret");
|
||||
expect(cipher.fields.at(3).value).toEqual("TOTPCODE");
|
||||
expect(cipher.fields.at(3).type).toEqual(FieldType.Hidden);
|
||||
});
|
||||
|
||||
it("should parse note data", async () => {
|
||||
|
@ -49,11 +49,12 @@ export const testData: ProtonPassJsonFile = {
|
||||
],
|
||||
type: "login",
|
||||
content: {
|
||||
username: "Username",
|
||||
itemEmail: "Username",
|
||||
password: "Password",
|
||||
urls: ["https://example.com/", "https://example2.com/"],
|
||||
totpUri:
|
||||
"otpauth://totp/Test%20Login%20-%20Personal%20Vault:Username?issuer=Test%20Login%20-%20Personal%20Vault&secret=TOTPCODE&algorithm=SHA1&digits=6&period=30",
|
||||
itemUsername: "someOtherUsername",
|
||||
},
|
||||
},
|
||||
state: 1,
|
||||
@ -156,10 +157,11 @@ export const testData: ProtonPassJsonFile = {
|
||||
extraFields: [],
|
||||
type: "login",
|
||||
content: {
|
||||
username: "other vault username",
|
||||
itemEmail: "other vault username",
|
||||
password: "other vault password",
|
||||
urls: [],
|
||||
totpUri: "JBSWY3DPEHPK3PXP",
|
||||
itemUsername: "",
|
||||
},
|
||||
},
|
||||
state: 1,
|
||||
|
@ -48,9 +48,10 @@ export class ProtonPassJsonImporter extends BaseImporter implements Importer {
|
||||
case "login": {
|
||||
const loginContent = item.data.content as ProtonPassLoginItemContent;
|
||||
cipher.login.uris = this.makeUriArray(loginContent.urls);
|
||||
cipher.login.username = this.getValueOrDefault(loginContent.username);
|
||||
cipher.login.username = this.getValueOrDefault(loginContent.itemEmail);
|
||||
cipher.login.password = this.getValueOrDefault(loginContent.password);
|
||||
cipher.login.totp = this.getValueOrDefault(loginContent.totpUri);
|
||||
this.processKvp(cipher, "itemUsername", loginContent.itemUsername);
|
||||
for (const extraField of item.data.extraFields) {
|
||||
this.processKvp(
|
||||
cipher,
|
||||
|
@ -56,10 +56,11 @@ export type ProtonPassItemExtraFieldData = {
|
||||
};
|
||||
|
||||
export type ProtonPassLoginItemContent = {
|
||||
username?: string;
|
||||
itemEmail?: string;
|
||||
password?: string;
|
||||
urls?: string[];
|
||||
totpUri?: string;
|
||||
itemUsername?: string;
|
||||
};
|
||||
|
||||
export type ProtonPassCreditCardItemContent = {
|
||||
|
Loading…
Reference in New Issue
Block a user