mirror of
https://github.com/bitwarden/clients.git
synced 2026-07-04 21:05:54 +08:00
[PM-33459] fix(autofill): exclude username-only scenario from new cipher save notification (#19733)
* [pm-33459] fix: exclude username-only input from new cipher notification trigger in triggerCipherNotification Signed-off-by: Ben Brooks <bbrooks@bitwarden.com>
This commit is contained in:
parent
50cf5bde99
commit
190997c4a4
@ -1642,7 +1642,7 @@ describe("NotificationBackground", () => {
|
||||
expect(pushAddLoginToQueueSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("and no cipher update candidates match `username`, trigger a new cipher notification", async () => {
|
||||
it("and no cipher update candidates match `username`, do not trigger a notification (username alone is insufficient signal)", async () => {
|
||||
const storedCiphersForURL = [
|
||||
mock<CipherView>({
|
||||
id: "cipher-id-1",
|
||||
@ -1660,15 +1660,7 @@ describe("NotificationBackground", () => {
|
||||
await notificationBackground.triggerCipherNotification(formEntryData, tab);
|
||||
|
||||
expect(pushChangePasswordToQueueSpy).not.toHaveBeenCalled();
|
||||
expect(pushAddLoginToQueueSpy).toHaveBeenCalledWith(
|
||||
mockFormattedURI,
|
||||
{
|
||||
password: "",
|
||||
url: formEntryData.uri,
|
||||
username: formEntryData.username,
|
||||
},
|
||||
sender.tab,
|
||||
);
|
||||
expect(pushAddLoginToQueueSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("and no cipher update candidates match `username`, do not trigger a new cipher notification if the new cipher notification setting is disabled", async () => {
|
||||
|
||||
@ -1018,13 +1018,15 @@ export default class NotificationBackground {
|
||||
// involves all ciphers, making it mutually exclusive from any other scenario)
|
||||
if (noFieldMatches.length === ciphersForURL.length) {
|
||||
// trigger a new cipher notification in these input scenarios
|
||||
// Note: username-only is excluded because a username with no password is insufficient
|
||||
// signal to assume a new login is being created. Multistep login forms accumulate
|
||||
// username + password across steps, so the combined data will trigger on form submission.
|
||||
if (
|
||||
(
|
||||
[
|
||||
inputScenarios.usernamePasswordNewPassword,
|
||||
inputScenarios.usernameNewPassword,
|
||||
inputScenarios.usernamePassword,
|
||||
inputScenarios.username,
|
||||
inputScenarios.passwordNewPassword,
|
||||
] as InputScenario[]
|
||||
).includes(inputScenario) &&
|
||||
|
||||
Loading…
Reference in New Issue
Block a user