1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-24 21:41:33 +01:00

[PM-2014] feat: add support for feature flag

This commit is contained in:
Andreas Coroiu 2023-05-15 13:52:48 +02:00
parent 031c00afd9
commit 0740dd0945
No known key found for this signature in database
GPG Key ID: E70B5FFC81DFEC1A
3 changed files with 13 additions and 3 deletions

View File

@ -130,4 +130,4 @@
</button>
</form>
<app-fido2-login-settings></app-fido2-login-settings>
<app-fido2-login-settings *ngIf="showFido2LoginSettings$ | async"></app-fido2-login-settings>

View File

@ -1,11 +1,12 @@
import { Component } from "@angular/core";
import { Router } from "@angular/router";
import { firstValueFrom } from "rxjs";
import { firstValueFrom, from, Observable } from "rxjs";
import { ChangePasswordComponent as BaseChangePasswordComponent } from "@bitwarden/angular/auth/components/change-password.component";
import { DialogServiceAbstraction, SimpleDialogType } from "@bitwarden/angular/services/dialog";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
import { ConfigServiceAbstraction } from "@bitwarden/common/abstractions/config/config.service.abstraction";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
@ -20,6 +21,7 @@ import { KeyConnectorService } from "@bitwarden/common/auth/abstractions/key-con
import { EmergencyAccessStatusType } from "@bitwarden/common/auth/enums/emergency-access-status-type";
import { EmergencyAccessUpdateRequest } from "@bitwarden/common/auth/models/request/emergency-access-update.request";
import { PasswordRequest } from "@bitwarden/common/auth/models/request/password.request";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { Utils } from "@bitwarden/common/misc/utils";
import { EncString } from "@bitwarden/common/models/domain/enc-string";
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetric-crypto-key";
@ -44,6 +46,8 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
checkForBreaches = true;
characterMinimumMessage = "";
protected showFido2LoginSettings$: Observable<boolean>;
constructor(
i18nService: I18nService,
cryptoService: CryptoService,
@ -63,7 +67,8 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
private router: Router,
private organizationApiService: OrganizationApiServiceAbstraction,
private organizationUserService: OrganizationUserService,
dialogService: DialogServiceAbstraction
dialogService: DialogServiceAbstraction,
private configService: ConfigServiceAbstraction
) {
super(
i18nService,
@ -78,6 +83,10 @@ export class ChangePasswordComponent extends BaseChangePasswordComponent {
}
async ngOnInit() {
this.showFido2LoginSettings$ = from(
this.configService.getFeatureFlagBool(FeatureFlag.PasswordlessLogin)
);
if (await this.keyConnectorService.getUsesKeyConnector()) {
this.router.navigate(["/settings/security/two-factor"]);
}

View File

@ -2,4 +2,5 @@ export enum FeatureFlag {
DisplayEuEnvironmentFlag = "display-eu-environment",
DisplayLowKdfIterationWarningFlag = "display-kdf-iteration-warning",
TrustedDeviceEncryption = "trusted-device-encryption",
PasswordlessLogin = "passwordless-login",
}