1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

[PM-3330] Force Update to Lockable Accounts on PIN/Biometric Update (#6006)

* Add Listener For Events that Need To Redraw the Menu

* Send redrawMenu Message When Pin/Biometrics Updated
This commit is contained in:
Justin Baur 2023-08-10 13:42:07 -04:00 committed by GitHub
parent 55482c5648
commit 6f84f4ca73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 21 deletions

View File

@ -429,6 +429,7 @@ export class SettingsComponent implements OnInit {
await this.vaultTimeoutSettingsService.clear();
}
this.messagingService.send("redrawMenu");
}
async updateBiometric(enabled: boolean) {
@ -437,29 +438,33 @@ export class SettingsComponent implements OnInit {
// The bug should resolve itself once the angular issue is resolved.
// See: https://github.com/angular/angular/issues/13063
if (!enabled || !this.supportsBiometric) {
this.form.controls.biometric.setValue(false, { emitEvent: false });
await this.stateService.setBiometricUnlock(null);
try {
if (!enabled || !this.supportsBiometric) {
this.form.controls.biometric.setValue(false, { emitEvent: false });
await this.stateService.setBiometricUnlock(null);
await this.cryptoService.refreshAdditionalKeys();
return;
}
await this.stateService.setBiometricUnlock(true);
if (this.isWindows) {
// Recommended settings for Windows Hello
this.form.controls.requirePasswordOnStart.setValue(true);
this.form.controls.autoPromptBiometrics.setValue(false);
await this.stateService.setDisableAutoBiometricsPrompt(true);
await this.stateService.setBiometricRequirePasswordOnStart(true);
await this.stateService.setDismissedBiometricRequirePasswordOnStart();
}
await this.cryptoService.refreshAdditionalKeys();
return;
}
await this.stateService.setBiometricUnlock(true);
if (this.isWindows) {
// Recommended settings for Windows Hello
this.form.controls.requirePasswordOnStart.setValue(true);
this.form.controls.autoPromptBiometrics.setValue(false);
await this.stateService.setDisableAutoBiometricsPrompt(true);
await this.stateService.setBiometricRequirePasswordOnStart(true);
await this.stateService.setDismissedBiometricRequirePasswordOnStart();
}
await this.cryptoService.refreshAdditionalKeys();
// Validate the key is stored in case biometrics fail.
const biometricSet = await this.cryptoService.hasUserKeyStored(KeySuffixOptions.Biometric);
this.form.controls.biometric.setValue(biometricSet, { emitEvent: false });
if (!biometricSet) {
await this.stateService.setBiometricUnlock(null);
// Validate the key is stored in case biometrics fail.
const biometricSet = await this.cryptoService.hasUserKeyStored(KeySuffixOptions.Biometric);
this.form.controls.biometric.setValue(biometricSet, { emitEvent: false });
if (!biometricSet) {
await this.stateService.setBiometricUnlock(null);
}
} finally {
this.messagingService.send("redrawMenu");
}
}

View File

@ -404,6 +404,9 @@ export class AppComponent implements OnInit, OnDestroy {
await this.openLoginApproval(message.notificationId);
}
break;
case "redrawMenu":
await this.updateAppMenu();
break;
}
});
});