mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-16 01:21:48 +01:00
[PS-1514] Do not subscribe to activeAccount-observable and execute load asynchronously (#3608)
* Fix async subscribe
* Revert "[PS-1066] Browser and Desktop - SSO User does not see Update Master Password screen after Owner does a Admin Password Reset (#3207)"
This reverts commit 0eda418591
.
This commit is contained in:
parent
b153ed6d01
commit
43d586ff99
@ -12,7 +12,6 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction";
|
|
||||||
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
||||||
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service";
|
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service";
|
||||||
import { AuthenticationStatus } from "@bitwarden/common/enums/authenticationStatus";
|
import { AuthenticationStatus } from "@bitwarden/common/enums/authenticationStatus";
|
||||||
@ -28,8 +27,6 @@ export class LockComponent extends BaseLockComponent {
|
|||||||
|
|
||||||
biometricError: string;
|
biometricError: string;
|
||||||
pendingBiometric = false;
|
pendingBiometric = false;
|
||||||
authenicatedUrl = "/tabs/current";
|
|
||||||
unAuthenicatedUrl = "/update-temp-password";
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
router: Router,
|
router: Router,
|
||||||
@ -45,8 +42,7 @@ export class LockComponent extends BaseLockComponent {
|
|||||||
logService: LogService,
|
logService: LogService,
|
||||||
keyConnectorService: KeyConnectorService,
|
keyConnectorService: KeyConnectorService,
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
private authService: AuthService,
|
private authService: AuthService
|
||||||
private syncService: SyncService
|
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
router,
|
router,
|
||||||
@ -63,17 +59,12 @@ export class LockComponent extends BaseLockComponent {
|
|||||||
keyConnectorService,
|
keyConnectorService,
|
||||||
ngZone
|
ngZone
|
||||||
);
|
);
|
||||||
|
this.successRoute = "/tabs/current";
|
||||||
this.isInitialLockScreen = (window as any).previousPopupUrl == null;
|
this.isInitialLockScreen = (window as any).previousPopupUrl == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
await this.syncService.fullSync(true);
|
|
||||||
|
|
||||||
const forcePasswordReset = await this.stateService.getForcePasswordReset();
|
|
||||||
this.successRoute = forcePasswordReset === true ? this.unAuthenicatedUrl : this.authenicatedUrl;
|
|
||||||
|
|
||||||
const disableAutoBiometricsPrompt =
|
const disableAutoBiometricsPrompt =
|
||||||
(await this.stateService.getDisableAutoBiometricsPrompt()) ?? true;
|
(await this.stateService.getDisableAutoBiometricsPrompt()) ?? true;
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync/sync.service.abstraction";
|
|
||||||
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
import { VaultTimeoutService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeout.service";
|
||||||
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service";
|
import { VaultTimeoutSettingsService } from "@bitwarden/common/abstractions/vaultTimeout/vaultTimeoutSettings.service";
|
||||||
|
|
||||||
@ -25,8 +24,6 @@ const BroadcasterSubscriptionId = "LockComponent";
|
|||||||
})
|
})
|
||||||
export class LockComponent extends BaseLockComponent {
|
export class LockComponent extends BaseLockComponent {
|
||||||
private deferFocus: boolean = null;
|
private deferFocus: boolean = null;
|
||||||
authenicatedUrl = "vault";
|
|
||||||
unAuthenicatedUrl = "update-temp-password";
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
router: Router,
|
router: Router,
|
||||||
@ -43,8 +40,7 @@ export class LockComponent extends BaseLockComponent {
|
|||||||
private broadcasterService: BroadcasterService,
|
private broadcasterService: BroadcasterService,
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
keyConnectorService: KeyConnectorService,
|
keyConnectorService: KeyConnectorService
|
||||||
private syncService: SyncService
|
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
router,
|
router,
|
||||||
@ -67,11 +63,6 @@ export class LockComponent extends BaseLockComponent {
|
|||||||
await super.ngOnInit();
|
await super.ngOnInit();
|
||||||
const autoPromptBiometric = !(await this.stateService.getNoAutoPromptBiometrics());
|
const autoPromptBiometric = !(await this.stateService.getNoAutoPromptBiometrics());
|
||||||
|
|
||||||
await this.syncService.fullSync(true);
|
|
||||||
|
|
||||||
const forcePasswordReset = await this.stateService.getForcePasswordReset();
|
|
||||||
this.successRoute = forcePasswordReset === true ? this.unAuthenicatedUrl : this.authenicatedUrl;
|
|
||||||
|
|
||||||
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
this.route.queryParams.subscribe((params) => {
|
this.route.queryParams.subscribe((params) => {
|
||||||
if (this.supportsBiometric && params.promptBiometric && autoPromptBiometric) {
|
if (this.supportsBiometric && params.promptBiometric && autoPromptBiometric) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Directive, NgZone, OnDestroy, OnInit } from "@angular/core";
|
import { Directive, NgZone, OnDestroy, OnInit } from "@angular/core";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
import { Subscription } from "rxjs";
|
import { Subject } from "rxjs";
|
||||||
import { take } from "rxjs/operators";
|
import { concatMap, take, takeUntil } from "rxjs/operators";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
||||||
@ -41,7 +41,7 @@ export class LockComponent implements OnInit, OnDestroy {
|
|||||||
private invalidPinAttempts = 0;
|
private invalidPinAttempts = 0;
|
||||||
private pinSet: [boolean, boolean];
|
private pinSet: [boolean, boolean];
|
||||||
|
|
||||||
private activeAccountSubscription: Subscription;
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
@ -60,14 +60,19 @@ export class LockComponent implements OnInit, OnDestroy {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
// eslint-disable-next-line rxjs/no-async-subscribe
|
this.stateService.activeAccount$
|
||||||
this.activeAccountSubscription = this.stateService.activeAccount$.subscribe(async () => {
|
.pipe(
|
||||||
await this.load();
|
concatMap(async () => {
|
||||||
});
|
await this.load();
|
||||||
|
}),
|
||||||
|
takeUntil(this.destroy$)
|
||||||
|
)
|
||||||
|
.subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.activeAccountSubscription.unsubscribe();
|
this.destroy$.next();
|
||||||
|
this.destroy$.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
|
Loading…
Reference in New Issue
Block a user