mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
Bug 1891884
- Allowing to dismiss breach alerts in Megalist r=issammani
Differential Revision: https://phabricator.services.mozilla.com/D207648
This commit is contained in:
parent
0ee325d4b5
commit
59eca3ecdb
@ -147,6 +147,11 @@ export const LoginBreaches = {
|
||||
return vulnerablePasswordsByLoginGUID;
|
||||
},
|
||||
|
||||
recordBreachAlertDismissal(loginGuid) {
|
||||
const storageJSON = Services.logins.wrappedJSObject._storage;
|
||||
return storageJSON.recordBreachAlertDismissal(loginGuid);
|
||||
},
|
||||
|
||||
isVulnerablePassword(login) {
|
||||
if (!lazy.VULNERABLE_PASSWORDS_ENABLED) {
|
||||
return false;
|
||||
|
@ -67,6 +67,13 @@ export class MegalistViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
#commandsArray(snapshot) {
|
||||
if (Array.isArray(snapshot.commands)) {
|
||||
return snapshot.commands;
|
||||
}
|
||||
return Array.from(snapshot.commands());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Send snapshot of necessary line data across parent-child boundary.
|
||||
@ -95,7 +102,7 @@ export class MegalistViewModel {
|
||||
snapshot.end = snapshotData.end;
|
||||
}
|
||||
if ("commands" in snapshotData) {
|
||||
snapshot.commands = snapshotData.commands;
|
||||
snapshot.commands = this.#commandsArray(snapshotData);
|
||||
}
|
||||
if ("valueIcon" in snapshotData) {
|
||||
snapshot.valueIcon = snapshotData.valueIcon;
|
||||
@ -182,8 +189,9 @@ export class MegalistViewModel {
|
||||
: this.#selectedIndex;
|
||||
const snapshot = this.#snapshots[index];
|
||||
if (snapshot) {
|
||||
commandId = commandId ?? snapshot.commands[0]?.id;
|
||||
const mustVerify = snapshot.commands.find(c => c.id == commandId)?.verify;
|
||||
const commands = this.#commandsArray(snapshot);
|
||||
commandId = commandId ?? commands[0]?.id;
|
||||
const mustVerify = commands.find(c => c.id == commandId)?.verify;
|
||||
if (!mustVerify || (await this.#verifyUser())) {
|
||||
// TODO:Enter the prompt message and pref for #verifyUser()
|
||||
await snapshot[`execute${commandId}`]?.(value);
|
||||
|
@ -266,7 +266,7 @@ export class BankCardDataSource extends DataSourceBase {
|
||||
`${card["cc-exp-month"]}/${card["cc-exp-year"]}`
|
||||
.toUpperCase()
|
||||
.includes(searchText) ||
|
||||
card["cc-name"].toUpperCase().includes(searchText)
|
||||
card["cc-name"]?.toUpperCase().includes(searchText)
|
||||
);
|
||||
|
||||
this.formatMessages({
|
||||
|
@ -63,10 +63,15 @@ export class LoginDataSource extends DataSourceBase {
|
||||
"passwords-import-file-picker-csv-filter-title",
|
||||
passwordsImportFilePickerTsvFilterTitle:
|
||||
"passwords-import-file-picker-tsv-filter-title",
|
||||
dismissBreachCommandLabel: "passwords-dismiss-breach-alert-command",
|
||||
}).then(strings => {
|
||||
const copyCommand = { id: "Copy", label: strings.copyCommandLabel };
|
||||
const editCommand = { id: "Edit", label: strings.editCommandLabel };
|
||||
const deleteCommand = { id: "Delete", label: strings.deleteCommandLabel };
|
||||
const dismissBreachCommand = {
|
||||
id: "DismissBreach",
|
||||
label: strings.dismissBreachCommandLabel,
|
||||
};
|
||||
const noOriginSticker = { type: "error", label: "😾 Missing origin" };
|
||||
const noPasswordSticker = { type: "error", label: "😾 Missing password" };
|
||||
const breachedSticker = { type: "warning", label: "BREACH" };
|
||||
@ -115,12 +120,23 @@ export class LoginDataSource extends DataSourceBase {
|
||||
},
|
||||
},
|
||||
commands: {
|
||||
value: [
|
||||
{ id: "Open", label: strings.openCommandLabel },
|
||||
copyCommand,
|
||||
"-",
|
||||
deleteCommand,
|
||||
],
|
||||
*value() {
|
||||
yield { id: "Open", label: strings.openCommandLabel };
|
||||
yield copyCommand;
|
||||
yield "-";
|
||||
yield deleteCommand;
|
||||
|
||||
if (this.breached) {
|
||||
yield dismissBreachCommand;
|
||||
}
|
||||
},
|
||||
},
|
||||
executeDismissBreach: {
|
||||
value() {
|
||||
lazy.LoginBreaches.recordBreachAlertDismissal(this.record.guid);
|
||||
delete this.breached;
|
||||
this.refreshOnScreen();
|
||||
},
|
||||
},
|
||||
executeCopy: {
|
||||
value() {
|
||||
|
@ -23,6 +23,7 @@ command-cancel = Cancel
|
||||
passwords-section-label = Passwords
|
||||
passwords-disabled = Passwords are disabled
|
||||
|
||||
passwords-dismiss-breach-alert-command = Dismiss breach alert
|
||||
passwords-command-create = Add Password
|
||||
passwords-command-import = Import from a File…
|
||||
passwords-command-export = Export Passwords…
|
||||
|
Loading…
Reference in New Issue
Block a user