check for features being disabled

This commit is contained in:
Kyle Spearrin 2018-08-07 09:22:06 -04:00
parent 0a825899db
commit 4ac447b2d2
2 changed files with 12 additions and 1 deletions

View File

@ -280,6 +280,11 @@ export default class RuntimeBackground {
const ciphers = await this.cipherService.getAllDecryptedForUrl(loginInfo.url);
const usernameMatches = ciphers.filter((c) => c.login.username === loginInfo.username);
if (usernameMatches.length === 0) {
const disabledAddLogin = await this.storageService.get<boolean>(
ConstantsService.disableAddLoginNotificationKey);
if (disabledAddLogin) {
return;
}
// remove any old messages for this tab
this.removeTabFromNotificationQueue(tab);
this.main.notificationQueue.push({
@ -293,6 +298,11 @@ export default class RuntimeBackground {
});
await this.main.checkNotificationQueue(tab);
} else if (usernameMatches.length === 1 && usernameMatches[0].login.password !== loginInfo.password) {
const disabledChangePassword = await this.storageService.get<boolean>(
ConstantsService.disableChangedPasswordNotificationKey);
if (disabledChangePassword) {
return;
}
this.addChangedPasswordToQueue(usernameMatches[0].id, loginDomain, loginInfo.password, tab);
}
}

View File

@ -326,7 +326,8 @@ document.addEventListener('DOMContentLoaded', (event) => {
if (formData[i].formEl !== form) {
continue;
}
if (!disabledAddLoginNotification && formData[i].usernameEl != null && formData[i].passwordEl != null) {
const disabledBoth = disabledChangedPasswordNotification && disabledAddLoginNotification;
if (!disabledBoth && formData[i].usernameEl != null && formData[i].passwordEl != null) {
const login = {
username: formData[i].usernameEl.value,
password: formData[i].passwordEl.value,