mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 15:23:33 +00:00
[PM-7169][PM-5267] Remove auth status from account info (#8539)
* remove active account unlocked from state service * Remove status from account service `AccountInfo` * Fixup lingering usages of status Fixup missed factories * Fixup account info usage * fixup CLI build * Fixup current account type * Add helper for all auth statuses to auth service * Fix tests * Uncomment mistakenly commented code * Rework logged out account exclusion tests * Correct test description * Avoid getters returning observables * fixup type
This commit is contained in:
@@ -2,7 +2,6 @@ import { Injectable, inject } from "@angular/core";
|
||||
import { CanActivate, CanActivateFn, Router, UrlTree } from "@angular/router";
|
||||
import { Observable, map } from "rxjs";
|
||||
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||
|
||||
@@ -43,14 +42,14 @@ const defaultRoutes: UnauthRoutes = {
|
||||
};
|
||||
|
||||
function unauthGuard(routes: UnauthRoutes): Observable<boolean | UrlTree> {
|
||||
const accountService = inject(AccountService);
|
||||
const authService = inject(AuthService);
|
||||
const router = inject(Router);
|
||||
|
||||
return accountService.activeAccount$.pipe(
|
||||
map((accountData) => {
|
||||
if (accountData == null || accountData.status === AuthenticationStatus.LoggedOut) {
|
||||
return authService.activeAccountStatus$.pipe(
|
||||
map((status) => {
|
||||
if (status == null || status === AuthenticationStatus.LoggedOut) {
|
||||
return true;
|
||||
} else if (accountData.status === AuthenticationStatus.Locked) {
|
||||
} else if (status === AuthenticationStatus.Locked) {
|
||||
return router.createUrlTree([routes.locked]);
|
||||
} else {
|
||||
return router.createUrlTree([routes.homepage()]);
|
||||
|
||||
Reference in New Issue
Block a user