mirror of
https://github.com/bitwarden/browser
synced 2026-01-03 17:13:47 +00:00
* Use account service to track accounts and active account * Remove state service active account Observables. * Add email verified to account service * Do not store account info on logged out accounts * Add account activity tracking to account service * Use last account activity from account service * migrate or replicate account service data * Add `AccountActivityService` that handles storing account last active data * Move active and next active user to account service * Remove authenticated accounts from state object * Fold account activity into account service * Fix builds * Fix desktop app switch * Fix logging out non active user * Expand helper to handle new authenticated accounts location * Prefer view observable to tons of async pipes * Fix `npm run test:types` * Correct user activity sorting test * Be more precise about log out messaging * Fix dev compare errors All stored values are serializable, the next step wasn't necessary and was erroring on some types that lack `toString`. * If the account in unlocked on load of lock component, navigate away from lock screen * Handle no users case for auth service statuses * Specify account to switch to * Filter active account out of inactive accounts * Prefer constructor init * Improve comparator * Use helper methods internally * Fixup component tests * Clarify name * Ensure accounts object has only valid userIds * Capitalize const values * Prefer descriptive, single-responsibility guards * Update libs/common/src/state-migrations/migrate.ts Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com> * Fix merge * Add user Id validation activity for undefined was being set, which was resulting in requests for the auth status of `"undefined"` (string) userId, due to key enumeration. These changes stop that at both locations, as well as account add for good measure. --------- Co-authored-by: Justin Baur <19896123+justindbaur@users.noreply.github.com>
97 lines
3.0 KiB
TypeScript
97 lines
3.0 KiB
TypeScript
import { NgModule } from "@angular/core";
|
|
import { RouterModule, Routes } from "@angular/router";
|
|
|
|
import {
|
|
AuthGuard,
|
|
lockGuard,
|
|
redirectGuard,
|
|
tdeDecryptionRequiredGuard,
|
|
} from "@bitwarden/angular/auth/guards";
|
|
|
|
import { AccessibilityCookieComponent } from "../auth/accessibility-cookie.component";
|
|
import { maxAccountsGuardFn } from "../auth/guards/max-accounts.guard";
|
|
import { HintComponent } from "../auth/hint.component";
|
|
import { LockComponent } from "../auth/lock.component";
|
|
import { LoginDecryptionOptionsComponent } from "../auth/login/login-decryption-options/login-decryption-options.component";
|
|
import { LoginViaAuthRequestComponent } from "../auth/login/login-via-auth-request.component";
|
|
import { LoginComponent } from "../auth/login/login.component";
|
|
import { RegisterComponent } from "../auth/register.component";
|
|
import { RemovePasswordComponent } from "../auth/remove-password.component";
|
|
import { SetPasswordComponent } from "../auth/set-password.component";
|
|
import { SsoComponent } from "../auth/sso.component";
|
|
import { TwoFactorComponent } from "../auth/two-factor.component";
|
|
import { UpdateTempPasswordComponent } from "../auth/update-temp-password.component";
|
|
import { VaultComponent } from "../vault/app/vault/vault.component";
|
|
|
|
import { SendComponent } from "./tools/send/send.component";
|
|
|
|
const routes: Routes = [
|
|
{
|
|
path: "",
|
|
pathMatch: "full",
|
|
children: [], // Children lets us have an empty component.
|
|
canActivate: [redirectGuard({ loggedIn: "/vault", loggedOut: "/login", locked: "/lock" })],
|
|
},
|
|
{
|
|
path: "lock",
|
|
component: LockComponent,
|
|
canActivate: [lockGuard()],
|
|
},
|
|
{
|
|
path: "login",
|
|
component: LoginComponent,
|
|
canActivate: [maxAccountsGuardFn()],
|
|
},
|
|
{
|
|
path: "login-with-device",
|
|
component: LoginViaAuthRequestComponent,
|
|
},
|
|
{
|
|
path: "admin-approval-requested",
|
|
component: LoginViaAuthRequestComponent,
|
|
},
|
|
{ path: "2fa", component: TwoFactorComponent },
|
|
{
|
|
path: "login-initiated",
|
|
component: LoginDecryptionOptionsComponent,
|
|
canActivate: [tdeDecryptionRequiredGuard()],
|
|
},
|
|
{ path: "register", component: RegisterComponent },
|
|
{
|
|
path: "vault",
|
|
component: VaultComponent,
|
|
canActivate: [AuthGuard],
|
|
},
|
|
{ path: "accessibility-cookie", component: AccessibilityCookieComponent },
|
|
{ path: "hint", component: HintComponent },
|
|
{ path: "set-password", component: SetPasswordComponent },
|
|
{ path: "sso", component: SsoComponent },
|
|
{
|
|
path: "send",
|
|
component: SendComponent,
|
|
canActivate: [AuthGuard],
|
|
},
|
|
{
|
|
path: "update-temp-password",
|
|
component: UpdateTempPasswordComponent,
|
|
canActivate: [AuthGuard],
|
|
},
|
|
{
|
|
path: "remove-password",
|
|
component: RemovePasswordComponent,
|
|
canActivate: [AuthGuard],
|
|
data: { titleId: "removeMasterPassword" },
|
|
},
|
|
];
|
|
|
|
@NgModule({
|
|
imports: [
|
|
RouterModule.forRoot(routes, {
|
|
useHash: true,
|
|
/*enableTracing: true,*/
|
|
}),
|
|
],
|
|
exports: [RouterModule],
|
|
})
|
|
export class AppRoutingModule {}
|