1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-02 16:43:19 +00:00

[PM-5537] Persist require password on startup through logout (#7825)

* Persist require password on startup through logout

* Test new methods
This commit is contained in:
Matt Gibson
2024-02-07 10:39:54 -05:00
committed by GitHub
parent 0eb9e760aa
commit 2ca34b46db
10 changed files with 161 additions and 121 deletions

View File

@@ -12,6 +12,7 @@ import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { UserVerificationService as UserVerificationServiceAbstraction } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
import { DeviceType } from "@bitwarden/common/enums";
import { VaultTimeoutAction } from "@bitwarden/common/enums/vault-timeout-action.enum";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
@@ -22,7 +23,6 @@ import { DialogService } from "@bitwarden/components";
import { SetPinComponent } from "../../auth/components/set-pin.component";
import { flagEnabled } from "../../platform/flags";
import { ElectronCryptoService } from "../../platform/services/electron-crypto.service";
import { ElectronStateService } from "../../platform/services/electron-state.service.abstraction";
@Component({
selector: "app-settings",
@@ -113,7 +113,7 @@ export class SettingsComponent implements OnInit {
private vaultTimeoutSettingsService: VaultTimeoutSettingsService,
private stateService: ElectronStateService,
private messagingService: MessagingService,
private cryptoService: ElectronCryptoService,
private cryptoService: CryptoService,
private modalService: ModalService,
private themingService: AbstractThemingService,
private settingsService: SettingsService,
@@ -457,7 +457,7 @@ export class SettingsComponent implements OnInit {
this.form.controls.requirePasswordOnStart.setValue(true);
this.form.controls.autoPromptBiometrics.setValue(false);
await this.stateService.setDisableAutoBiometricsPrompt(true);
await this.cryptoService.setBiometricClientKeyHalf();
await this.biometricStateService.setRequirePasswordOnStart(true);
await this.stateService.setDismissedBiometricRequirePasswordOnStart();
}
await this.cryptoService.refreshAdditionalKeys();
@@ -491,9 +491,9 @@ export class SettingsComponent implements OnInit {
this.form.controls.autoPromptBiometrics.setValue(false);
await this.updateAutoPromptBiometrics();
await this.cryptoService.setBiometricClientKeyHalf();
await this.biometricStateService.setRequirePasswordOnStart(true);
} else {
await this.cryptoService.removeBiometricClientKeyHalf();
await this.biometricStateService.setRequirePasswordOnStart(false);
}
await this.stateService.setDismissedBiometricRequirePasswordOnStart();
await this.cryptoService.refreshAdditionalKeys();

View File

@@ -48,10 +48,7 @@ import { DialogService } from "@bitwarden/components";
import { LoginGuard } from "../../auth/guards/login.guard";
import { Account } from "../../models/account";
import {
DefaultElectronCryptoService,
ElectronCryptoService,
} from "../../platform/services/electron-crypto.service";
import { ElectronCryptoService } from "../../platform/services/electron-crypto.service";
import { ElectronLogService } from "../../platform/services/electron-log.service";
import { ElectronPlatformUtilsService } from "../../platform/services/electron-platform-utils.service";
import { ElectronRendererMessagingService } from "../../platform/services/electron-renderer-messaging.service";
@@ -182,11 +179,7 @@ const RELOAD_CALLBACK = new InjectionToken<() => any>("RELOAD_CALLBACK");
},
{
provide: CryptoServiceAbstraction,
useExisting: ElectronCryptoService,
},
{
provide: ElectronCryptoService,
useClass: DefaultElectronCryptoService,
useClass: ElectronCryptoService,
deps: [
CryptoFunctionServiceAbstraction,
EncryptService,