summaryrefslogtreecommitdiffstats
path: root/browser/components/aboutlogins/LoginBreaches.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/aboutlogins/LoginBreaches.sys.mjs')
-rw-r--r--browser/components/aboutlogins/LoginBreaches.sys.mjs23
1 files changed, 23 insertions, 0 deletions
diff --git a/browser/components/aboutlogins/LoginBreaches.sys.mjs b/browser/components/aboutlogins/LoginBreaches.sys.mjs
index b2a0af5e39..496e5de575 100644
--- a/browser/components/aboutlogins/LoginBreaches.sys.mjs
+++ b/browser/components/aboutlogins/LoginBreaches.sys.mjs
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
+
/**
* Manages breach alerts for saved logins using data from Firefox Monitor via
* RemoteSettings.
@@ -16,6 +18,13 @@ ChromeUtils.defineESModuleGetters(lazy, {
"resource://services-settings/RemoteSettingsClient.sys.mjs",
});
+XPCOMUtils.defineLazyPreferenceGetter(
+ lazy,
+ "VULNERABLE_PASSWORDS_ENABLED",
+ "signon.management.page.vulnerable-passwords.enabled",
+ false
+);
+
export const LoginBreaches = {
REMOTE_SETTINGS_COLLECTION: "fxmonitor-breaches",
@@ -138,6 +147,20 @@ 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;
+ }
+
+ const storageJSON = Services.logins.wrappedJSObject._storage;
+ return storageJSON.isPotentiallyVulnerablePassword(login);
+ },
+
async clearAllPotentiallyVulnerablePasswords() {
await Services.logins.initializationPromise;
const storageJSON = Services.logins.wrappedJSObject._storage;