Merge pull request #2180 from bitwarden/fix/save-when-locked

Don't save passwords if user is logged out
This commit is contained in:
Daniel James Smith 2021-11-17 20:33:02 +01:00 committed by GitHub
commit ec502c06a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -262,7 +262,7 @@ export default class MainBackground {
this.commandsBackground = new CommandsBackground(this, this.passwordGenerationService,
this.platformUtilsService, this.vaultTimeoutService);
this.notificationBackground = new NotificationBackground(this, this.autofillService, this.cipherService,
this.storageService, this.vaultTimeoutService, this.policyService, this.folderService);
this.storageService, this.vaultTimeoutService, this.policyService, this.folderService, this.userService);
this.tabsBackground = new TabsBackground(this, this.notificationBackground);
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService, this.passwordGenerationService,

View File

@ -8,8 +8,11 @@ import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { FolderService } from 'jslib-common/abstractions/folder.service';
import { PolicyService } from 'jslib-common/abstractions/policy.service';
import { StorageService } from 'jslib-common/abstractions/storage.service';
import { UserService } from 'jslib-common/abstractions/user.service';
import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service';
import { ConstantsService } from 'jslib-common/services/constants.service';
import { AutofillService } from '../services/abstractions/autofill.service';
import { BrowserApi } from '../browser/browserApi';
@ -34,7 +37,7 @@ export default class NotificationBackground {
constructor(private main: MainBackground, private autofillService: AutofillService,
private cipherService: CipherService, private storageService: StorageService,
private vaultTimeoutService: VaultTimeoutService, private policyService: PolicyService,
private folderService: FolderService) {
private folderService: FolderService, private userService: UserService) {
}
async init() {
@ -181,6 +184,10 @@ export default class NotificationBackground {
}
private async addLogin(loginInfo: AddLoginRuntimeMessage, tab: chrome.tabs.Tab) {
if (!await this.userService.isAuthenticated()) {
return;
}
const loginDomain = Utils.getDomain(loginInfo.url);
if (loginDomain == null) {
return;