[PM-5488] Master password re-prompt not triggering correctly from autofill action (#7590)
* [PM-5488] Master Password Re-prompt Not Triggering Correctly When Autofilling From Command * [PM-5488] Master Password Re-prompt Not Triggering Correctly When Autofilling From Command * [PM-5488] Adjusting how we handle debouncing the password reprompt window
This commit is contained in:
parent
d77e3c3352
commit
d85485e5cb
|
@ -909,6 +909,28 @@ describe("AutofillService", () => {
|
||||||
expect(autofillService.doAutoFill).not.toHaveBeenCalled();
|
expect(autofillService.doAutoFill).not.toHaveBeenCalled();
|
||||||
expect(result).toBeNull();
|
expect(result).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("skips autofill and does not launch the password reprompt window if the password reprompt is currently debouncing", async () => {
|
||||||
|
cipher.reprompt = CipherRepromptType.Password;
|
||||||
|
jest.spyOn(autofillService, "doAutoFill");
|
||||||
|
jest.spyOn(cipherService, "getNextCipherForUrl").mockResolvedValueOnce(cipher);
|
||||||
|
jest
|
||||||
|
.spyOn(userVerificationService, "hasMasterPasswordAndMasterKeyHash")
|
||||||
|
.mockResolvedValueOnce(true);
|
||||||
|
jest
|
||||||
|
.spyOn(autofillService as any, "openVaultItemPasswordRepromptPopout")
|
||||||
|
.mockImplementation();
|
||||||
|
jest
|
||||||
|
.spyOn(autofillService as any, "isDebouncingPasswordRepromptPopout")
|
||||||
|
.mockReturnValueOnce(true);
|
||||||
|
|
||||||
|
const result = await autofillService.doAutoFillOnTab(pageDetails, tab, true);
|
||||||
|
|
||||||
|
expect(cipherService.getNextCipherForUrl).toHaveBeenCalledWith(tab.url);
|
||||||
|
expect(autofillService["openVaultItemPasswordRepromptPopout"]).not.toHaveBeenCalled();
|
||||||
|
expect(autofillService.doAutoFill).not.toHaveBeenCalled();
|
||||||
|
expect(result).toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -332,10 +332,7 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (await this.isPasswordRepromptRequired(cipher, tab)) {
|
||||||
(await this.isPasswordRepromptRequired(cipher, tab)) &&
|
|
||||||
!this.isDebouncingPasswordRepromptPopout()
|
|
||||||
) {
|
|
||||||
if (fromCommand) {
|
if (fromCommand) {
|
||||||
this.cipherService.updateLastUsedIndexForUrl(tab.url);
|
this.cipherService.updateLastUsedIndexForUrl(tab.url);
|
||||||
}
|
}
|
||||||
|
@ -368,10 +365,12 @@ export default class AutofillService implements AutofillServiceInterface {
|
||||||
const userHasMasterPasswordAndKeyHash =
|
const userHasMasterPasswordAndKeyHash =
|
||||||
await this.userVerificationService.hasMasterPasswordAndMasterKeyHash();
|
await this.userVerificationService.hasMasterPasswordAndMasterKeyHash();
|
||||||
if (cipher.reprompt === CipherRepromptType.Password && userHasMasterPasswordAndKeyHash) {
|
if (cipher.reprompt === CipherRepromptType.Password && userHasMasterPasswordAndKeyHash) {
|
||||||
await this.openVaultItemPasswordRepromptPopout(tab, {
|
if (!this.isDebouncingPasswordRepromptPopout()) {
|
||||||
cipherId: cipher.id,
|
await this.openVaultItemPasswordRepromptPopout(tab, {
|
||||||
action: "autofill",
|
cipherId: cipher.id,
|
||||||
});
|
action: "autofill",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue