2021-12-17 15:57:11 +01:00
|
|
|
import { NgModule } from "@angular/core";
|
|
|
|
import { RouterModule, Routes } from "@angular/router";
|
2018-06-05 05:10:41 +02:00
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { AuthGuard } from "@bitwarden/angular/guards/auth.guard";
|
|
|
|
import { LockGuard } from "@bitwarden/angular/guards/lock.guard";
|
|
|
|
import { UnauthGuard } from "@bitwarden/angular/guards/unauth.guard";
|
2018-06-08 23:08:19 +02:00
|
|
|
|
2021-12-17 15:57:11 +01:00
|
|
|
import { AcceptEmergencyComponent } from "./accounts/accept-emergency.component";
|
|
|
|
import { AcceptOrganizationComponent } from "./accounts/accept-organization.component";
|
|
|
|
import { HintComponent } from "./accounts/hint.component";
|
|
|
|
import { LockComponent } from "./accounts/lock.component";
|
|
|
|
import { LoginComponent } from "./accounts/login.component";
|
|
|
|
import { RecoverDeleteComponent } from "./accounts/recover-delete.component";
|
|
|
|
import { RecoverTwoFactorComponent } from "./accounts/recover-two-factor.component";
|
|
|
|
import { RegisterComponent } from "./accounts/register.component";
|
|
|
|
import { RemovePasswordComponent } from "./accounts/remove-password.component";
|
|
|
|
import { SetPasswordComponent } from "./accounts/set-password.component";
|
|
|
|
import { SsoComponent } from "./accounts/sso.component";
|
|
|
|
import { TwoFactorComponent } from "./accounts/two-factor.component";
|
2022-02-03 06:00:57 +01:00
|
|
|
import { UpdatePasswordComponent } from "./accounts/update-password.component";
|
2021-12-17 15:57:11 +01:00
|
|
|
import { UpdateTempPasswordComponent } from "./accounts/update-temp-password.component";
|
|
|
|
import { VerifyEmailTokenComponent } from "./accounts/verify-email-token.component";
|
|
|
|
import { VerifyRecoverDeleteComponent } from "./accounts/verify-recover-delete.component";
|
2022-04-25 15:41:44 +02:00
|
|
|
import { HomeGuard } from "./guards/home.guard";
|
2022-02-24 12:10:07 +01:00
|
|
|
import { FrontendLayoutComponent } from "./layouts/frontend-layout.component";
|
|
|
|
import { UserLayoutComponent } from "./layouts/user-layout.component";
|
2022-07-05 21:25:14 +02:00
|
|
|
import { TrialInitiationComponent } from "./modules/trial-initiation/trial-initiation.component";
|
2022-06-28 22:24:21 +02:00
|
|
|
import { IndividualVaultModule } from "./modules/vault/modules/individual-vault/individual-vault.module";
|
|
|
|
import { OrganizationsRoutingModule } from "./organizations/organization-routing.module";
|
2022-04-25 15:41:44 +02:00
|
|
|
import { AcceptFamilySponsorshipComponent } from "./organizations/sponsorships/accept-family-sponsorship.component";
|
2021-12-17 15:57:11 +01:00
|
|
|
import { FamiliesForEnterpriseSetupComponent } from "./organizations/sponsorships/families-for-enterprise-setup.component";
|
2022-06-28 22:24:21 +02:00
|
|
|
import { ReportsRoutingModule } from "./reports/reports-routing.module";
|
2021-12-17 15:57:11 +01:00
|
|
|
import { AccessComponent } from "./send/access.component";
|
|
|
|
import { SendComponent } from "./send/send.component";
|
|
|
|
import { AccountComponent } from "./settings/account.component";
|
|
|
|
import { CreateOrganizationComponent } from "./settings/create-organization.component";
|
|
|
|
import { DomainRulesComponent } from "./settings/domain-rules.component";
|
2022-02-24 12:10:07 +01:00
|
|
|
import { EmergencyAccessViewComponent } from "./settings/emergency-access-view.component";
|
|
|
|
import { EmergencyAccessComponent } from "./settings/emergency-access.component";
|
2022-05-09 14:21:52 +02:00
|
|
|
import { PreferencesComponent } from "./settings/preferences.component";
|
2022-06-28 22:24:21 +02:00
|
|
|
import { SecurityRoutingModule } from "./settings/security-routing.module";
|
2021-12-17 15:57:11 +01:00
|
|
|
import { SettingsComponent } from "./settings/settings.component";
|
2022-02-24 12:10:07 +01:00
|
|
|
import { SponsoredFamiliesComponent } from "./settings/sponsored-families.component";
|
2022-06-28 22:24:21 +02:00
|
|
|
import { SubscriptionRoutingModule } from "./settings/subscription-routing.module";
|
2022-04-01 05:32:57 +02:00
|
|
|
import { GeneratorComponent } from "./tools/generator.component";
|
2021-12-17 15:57:11 +01:00
|
|
|
import { ToolsComponent } from "./tools/tools.component";
|
2018-06-05 05:10:41 +02:00
|
|
|
|
|
|
|
const routes: Routes = [
|
2021-12-17 15:57:11 +01:00
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
component: FrontendLayoutComponent,
|
2022-04-25 15:41:44 +02:00
|
|
|
data: { doNotSaveUrl: true },
|
2021-12-17 15:57:11 +01:00
|
|
|
children: [
|
2022-04-25 15:41:44 +02:00
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
pathMatch: "full",
|
|
|
|
children: [], // Children lets us have an empty component.
|
|
|
|
canActivate: [HomeGuard], // Redirects either to vault, login or lock page.
|
|
|
|
},
|
2022-05-09 14:21:52 +02:00
|
|
|
{ path: "login", component: LoginComponent, canActivate: [UnauthGuard] },
|
|
|
|
{ path: "2fa", component: TwoFactorComponent, canActivate: [UnauthGuard] },
|
2021-12-17 15:57:11 +01:00
|
|
|
{
|
|
|
|
path: "register",
|
|
|
|
component: RegisterComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [UnauthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "createAccount" },
|
|
|
|
},
|
2022-07-05 21:25:14 +02:00
|
|
|
{
|
|
|
|
path: "trial",
|
|
|
|
component: TrialInitiationComponent,
|
|
|
|
canActivate: [UnauthGuard],
|
|
|
|
data: { titleId: "startTrial" },
|
|
|
|
},
|
2021-12-17 15:57:11 +01:00
|
|
|
{
|
|
|
|
path: "sso",
|
|
|
|
component: SsoComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [UnauthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "enterpriseSingleSignOn" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "set-password",
|
|
|
|
component: SetPasswordComponent,
|
|
|
|
data: { titleId: "setMasterPassword" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "hint",
|
|
|
|
component: HintComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [UnauthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "passwordHint" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "lock",
|
|
|
|
component: LockComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [LockGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
{ path: "verify-email", component: VerifyEmailTokenComponent },
|
|
|
|
{
|
|
|
|
path: "accept-organization",
|
|
|
|
component: AcceptOrganizationComponent,
|
2022-04-25 15:41:44 +02:00
|
|
|
data: { titleId: "joinOrganization", doNotSaveUrl: false },
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "accept-emergency",
|
|
|
|
component: AcceptEmergencyComponent,
|
2022-04-25 15:41:44 +02:00
|
|
|
data: { titleId: "acceptEmergency", doNotSaveUrl: false },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "accept-families-for-enterprise",
|
|
|
|
component: AcceptFamilySponsorshipComponent,
|
|
|
|
data: { titleId: "acceptFamilySponsorship", doNotSaveUrl: false },
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
{ path: "recover", pathMatch: "full", redirectTo: "recover-2fa" },
|
|
|
|
{
|
|
|
|
path: "recover-2fa",
|
|
|
|
component: RecoverTwoFactorComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [UnauthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "recoverAccountTwoStep" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "recover-delete",
|
|
|
|
component: RecoverDeleteComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [UnauthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "deleteAccount" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "verify-recover-delete",
|
|
|
|
component: VerifyRecoverDeleteComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [UnauthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "deleteAccount" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "send/:sendId/:key",
|
|
|
|
component: AccessComponent,
|
|
|
|
data: { title: "Bitwarden Send" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "update-temp-password",
|
|
|
|
component: UpdateTempPasswordComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [AuthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "updateTempPassword" },
|
|
|
|
},
|
2022-02-03 06:00:57 +01:00
|
|
|
{
|
|
|
|
path: "update-password",
|
|
|
|
component: UpdatePasswordComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [AuthGuard],
|
2022-02-03 06:00:57 +01:00
|
|
|
data: { titleId: "updatePassword" },
|
|
|
|
},
|
2021-12-17 15:57:11 +01:00
|
|
|
{
|
|
|
|
path: "remove-password",
|
|
|
|
component: RemovePasswordComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [AuthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
data: { titleId: "removeMasterPassword" },
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
component: UserLayoutComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [AuthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
children: [
|
2022-05-09 14:21:52 +02:00
|
|
|
{
|
|
|
|
path: "vault",
|
2022-06-28 22:24:21 +02:00
|
|
|
loadChildren: () => IndividualVaultModule,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
2021-12-17 15:57:11 +01:00
|
|
|
{ path: "sends", component: SendComponent, data: { title: "Send" } },
|
2022-05-11 21:39:39 +02:00
|
|
|
{
|
|
|
|
path: "create-organization",
|
|
|
|
component: CreateOrganizationComponent,
|
|
|
|
data: { titleId: "newOrganization" },
|
|
|
|
},
|
2021-12-17 15:57:11 +01:00
|
|
|
{
|
|
|
|
path: "settings",
|
|
|
|
component: SettingsComponent,
|
2018-06-08 23:08:19 +02:00
|
|
|
children: [
|
2021-12-17 15:57:11 +01:00
|
|
|
{ path: "", pathMatch: "full", redirectTo: "account" },
|
|
|
|
{ path: "account", component: AccountComponent, data: { titleId: "myAccount" } },
|
|
|
|
{
|
2022-05-09 14:21:52 +02:00
|
|
|
path: "preferences",
|
|
|
|
component: PreferencesComponent,
|
|
|
|
data: { titleId: "preferences" },
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
{
|
2022-05-09 14:21:52 +02:00
|
|
|
path: "security",
|
2022-06-28 22:24:21 +02:00
|
|
|
loadChildren: () => SecurityRoutingModule,
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
{
|
2022-05-09 14:21:52 +02:00
|
|
|
path: "domain-rules",
|
|
|
|
component: DomainRulesComponent,
|
|
|
|
data: { titleId: "domainRules" },
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
{
|
2022-05-09 14:21:52 +02:00
|
|
|
path: "subscription",
|
2022-06-28 22:24:21 +02:00
|
|
|
loadChildren: () => SubscriptionRoutingModule,
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "emergency-access",
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
component: EmergencyAccessComponent,
|
|
|
|
data: { titleId: "emergencyAccess" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: ":id",
|
|
|
|
component: EmergencyAccessViewComponent,
|
|
|
|
data: { titleId: "emergencyAccess" },
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "sponsored-families",
|
|
|
|
component: SponsoredFamiliesComponent,
|
|
|
|
data: { titleId: "sponsoredFamilies" },
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "tools",
|
|
|
|
component: ToolsComponent,
|
2022-05-09 14:21:52 +02:00
|
|
|
canActivate: [AuthGuard],
|
2021-12-17 15:57:11 +01:00
|
|
|
children: [
|
|
|
|
{ path: "", pathMatch: "full", redirectTo: "generator" },
|
2022-06-28 22:24:21 +02:00
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
loadChildren: () =>
|
|
|
|
import("./tools/import-export/import-export.module").then(
|
|
|
|
(m) => m.ImportExportModule
|
|
|
|
),
|
|
|
|
},
|
2021-12-17 15:57:11 +01:00
|
|
|
{
|
|
|
|
path: "generator",
|
2022-04-01 05:32:57 +02:00
|
|
|
component: GeneratorComponent,
|
2022-03-29 21:02:48 +02:00
|
|
|
data: { titleId: "generator" },
|
2021-12-17 15:57:11 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2022-03-29 21:55:47 +02:00
|
|
|
{
|
|
|
|
path: "reports",
|
2022-06-28 22:24:21 +02:00
|
|
|
loadChildren: () => ReportsRoutingModule,
|
2022-03-29 21:55:47 +02:00
|
|
|
},
|
2021-12-17 15:57:11 +01:00
|
|
|
{ path: "setup/families-for-enterprise", component: FamiliesForEnterpriseSetupComponent },
|
|
|
|
],
|
|
|
|
},
|
2022-05-13 00:31:30 +02:00
|
|
|
{
|
|
|
|
path: "organizations",
|
2022-06-28 22:24:21 +02:00
|
|
|
loadChildren: () => OrganizationsRoutingModule,
|
2022-05-13 00:31:30 +02:00
|
|
|
},
|
2018-06-05 05:10:41 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
@NgModule({
|
2021-12-17 15:57:11 +01:00
|
|
|
imports: [
|
|
|
|
RouterModule.forRoot(routes, {
|
|
|
|
useHash: true,
|
|
|
|
paramsInheritanceStrategy: "always",
|
2022-05-09 14:21:52 +02:00
|
|
|
// enableTracing: true,
|
2021-12-17 15:57:11 +01:00
|
|
|
}),
|
|
|
|
],
|
|
|
|
exports: [RouterModule],
|
2018-06-05 05:10:41 +02:00
|
|
|
})
|
2021-12-17 15:57:11 +01:00
|
|
|
export class OssRoutingModule {}
|