1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

Fixed destroy subject inheritance issue on the login componenet

This commit is contained in:
gbubemismith
2023-08-23 14:33:34 -04:00
parent c06e1cff68
commit 036c142a8d
2 changed files with 9 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
import { Component, NgZone, OnDestroy, OnInit } from "@angular/core"; import { Component, NgZone, OnInit } from "@angular/core";
import { FormBuilder } from "@angular/forms"; import { FormBuilder } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { Subject, takeUntil } from "rxjs"; import { takeUntil } from "rxjs";
import { first } from "rxjs/operators"; import { first } from "rxjs/operators";
import { LoginComponent as BaseLoginComponent } from "@bitwarden/angular/auth/components/login.component"; import { LoginComponent as BaseLoginComponent } from "@bitwarden/angular/auth/components/login.component";
@@ -33,14 +33,13 @@ import { RouterService, StateService } from "../../core";
selector: "app-login", selector: "app-login",
templateUrl: "login.component.html", templateUrl: "login.component.html",
}) })
export class LoginComponent extends BaseLoginComponent implements OnInit, OnDestroy { // eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class LoginComponent extends BaseLoginComponent implements OnInit {
showResetPasswordAutoEnrollWarning = false; showResetPasswordAutoEnrollWarning = false;
enforcedPasswordPolicyOptions: MasterPasswordPolicyOptions; enforcedPasswordPolicyOptions: MasterPasswordPolicyOptions;
policies: ListResponse<PolicyResponse>; policies: ListResponse<PolicyResponse>;
showPasswordless = false; showPasswordless = false;
private destroy$ = new Subject<void>();
constructor( constructor(
devicesApiService: DevicesApiServiceAbstraction, devicesApiService: DevicesApiServiceAbstraction,
appIdService: AppIdService, appIdService: AppIdService,
@@ -145,9 +144,9 @@ export class LoginComponent extends BaseLoginComponent implements OnInit, OnDest
} }
} }
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
ngOnDestroy(): void { ngOnDestroy(): void {
this.destroy$.next(); super.ngOnDestroy();
this.destroy$.complete();
} }
async goAfterLogIn() { async goAfterLogIn() {

View File

@@ -1,4 +1,4 @@
import { Directive, ElementRef, NgZone, OnInit, ViewChild } from "@angular/core"; import { Directive, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from "@angular/core";
import { FormBuilder, Validators } from "@angular/forms"; import { FormBuilder, Validators } from "@angular/forms";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
@@ -28,7 +28,7 @@ import {
import { CaptchaProtectedComponent } from "./captcha-protected.component"; import { CaptchaProtectedComponent } from "./captcha-protected.component";
@Directive() @Directive()
export class LoginComponent extends CaptchaProtectedComponent implements OnInit { export class LoginComponent extends CaptchaProtectedComponent implements OnInit, OnDestroy {
@ViewChild("masterPasswordInput", { static: true }) masterPasswordInput: ElementRef; @ViewChild("masterPasswordInput", { static: true }) masterPasswordInput: ElementRef;
showPassword = false; showPassword = false;
@@ -52,7 +52,7 @@ export class LoginComponent extends CaptchaProtectedComponent implements OnInit
protected successRoute = "vault"; protected successRoute = "vault";
protected forcePasswordResetRoute = "update-temp-password"; protected forcePasswordResetRoute = "update-temp-password";
private destroy$ = new Subject<void>(); protected destroy$ = new Subject<void>();
get loggedEmail() { get loggedEmail() {
return this.formGroup.value.email; return this.formGroup.value.email;