1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

[AC-1343] Add bool parameter to conditionally evaluate password after successful unlock (#5260)

This commit is contained in:
Shane Melton 2023-04-21 14:40:56 -07:00 committed by GitHub
parent 89c8c48cd4
commit e777842191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,7 +114,7 @@ export class LockComponent implements OnInit, OnDestroy {
const success = (await this.cryptoService.getKey(KeySuffixOptions.Biometric)) != null; const success = (await this.cryptoService.getKey(KeySuffixOptions.Biometric)) != null;
if (success) { if (success) {
await this.doContinue(); await this.doContinue(false);
} }
return success; return success;
@ -251,19 +251,20 @@ export class LockComponent implements OnInit, OnDestroy {
await this.cryptoService.encrypt(key.key, pinKey) await this.cryptoService.encrypt(key.key, pinKey)
); );
} }
await this.setKeyAndContinue(key); await this.setKeyAndContinue(key, true);
} }
private async setKeyAndContinue(key: SymmetricCryptoKey) { private async setKeyAndContinue(key: SymmetricCryptoKey, evaluatePasswordAfterUnlock = false) {
await this.cryptoService.setKey(key); await this.cryptoService.setKey(key);
await this.doContinue(); await this.doContinue(evaluatePasswordAfterUnlock);
} }
private async doContinue() { private async doContinue(evaluatePasswordAfterUnlock: boolean) {
await this.stateService.setEverBeenUnlocked(true); await this.stateService.setEverBeenUnlocked(true);
const disableFavicon = await this.stateService.getDisableFavicon(); const disableFavicon = await this.stateService.getDisableFavicon();
await this.stateService.setDisableFavicon(!!disableFavicon); await this.stateService.setDisableFavicon(!!disableFavicon);
this.messagingService.send("unlocked"); this.messagingService.send("unlocked");
if (evaluatePasswordAfterUnlock) {
try { try {
// If we do not have any saved policies, attempt to load them from the service // If we do not have any saved policies, attempt to load them from the service
if (this.enforcedMasterPasswordOptions == undefined) { if (this.enforcedMasterPasswordOptions == undefined) {
@ -283,6 +284,7 @@ export class LockComponent implements OnInit, OnDestroy {
// Do not prevent unlock if there is an error evaluating policies // Do not prevent unlock if there is an error evaluating policies
this.logService.error(e); this.logService.error(e);
} }
}
if (this.onSuccessfulSubmit != null) { if (this.onSuccessfulSubmit != null) {
await this.onSuccessfulSubmit(); await this.onSuccessfulSubmit();