1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 06:13:38 +00:00

[PM-7084] 6/6: Introduce shared duo two-factor component (#9772)

* Add shared duo component

* Fix duo import

* Fix wrong i18n service DI in duo desktop component

* Remove duo v2

* Add override to functions

* Remove web duo implementation

* Update apps/browser/src/auth/popup/two-factor-auth-duo.component.ts

Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>

* Update apps/desktop/src/auth/two-factor-auth-duo.component.ts

Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>

* Update libs/angular/src/auth/components/two-factor-auth/two-factor-auth-duo.component.ts

Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>

* Fix missing service on duo components

* Fix missing service on base duo auth component

* Fix constructor super calls in duo auth component

* Fix duo auth components incorrectly extending base class

---------

Co-authored-by: Ike <137194738+ike-kottlowski@users.noreply.github.com>
This commit is contained in:
Bernd Schoolmann
2024-07-19 16:29:24 +02:00
committed by GitHub
parent bc1ee0a169
commit 05e8b45edb
10 changed files with 406 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
import { CommonModule } from "@angular/common";
import { Component, Inject, OnInit } from "@angular/core";
import { Component, Inject, OnInit, ViewChild } from "@angular/core";
import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms";
import { ActivatedRoute, NavigationExtras, Router, RouterLink } from "@angular/router";
import { Subject, takeUntil, lastValueFrom, first, firstValueFrom } from "rxjs";
@@ -39,6 +39,7 @@ import {
import { CaptchaProtectedComponent } from "../captcha-protected.component";
import { TwoFactorAuthAuthenticatorComponent } from "./two-factor-auth-authenticator.component";
import { TwoFactorAuthDuoComponent } from "./two-factor-auth-duo.component";
import { TwoFactorAuthEmailComponent } from "./two-factor-auth-email.component";
import { TwoFactorAuthWebAuthnComponent } from "./two-factor-auth-webauthn.component";
import { TwoFactorAuthYubikeyComponent } from "./two-factor-auth-yubikey.component";
@@ -63,6 +64,7 @@ import {
TwoFactorOptionsComponent,
TwoFactorAuthAuthenticatorComponent,
TwoFactorAuthEmailComponent,
TwoFactorAuthDuoComponent,
TwoFactorAuthYubikeyComponent,
TwoFactorAuthWebAuthnComponent,
],
@@ -78,6 +80,7 @@ export class TwoFactorAuthComponent extends CaptchaProtectedComponent implements
selectedProviderType: TwoFactorProviderType = TwoFactorProviderType.Authenticator;
providerData: any;
@ViewChild("duoComponent") duoComponent!: TwoFactorAuthDuoComponent;
formGroup = this.formBuilder.group({
token: [
"",
@@ -220,6 +223,12 @@ export class TwoFactorAuthComponent extends CaptchaProtectedComponent implements
}
}
async launchDuo() {
if (this.duoComponent != null) {
await this.duoComponent.launchDuoFrameless();
}
}
protected handleMigrateEncryptionKey(result: AuthResult): boolean {
if (!result.requiresEncryptionKeyMigration) {
return false;