bitwarden-estensione-browser/src/app/app-routing.module.ts

316 lines
15 KiB
TypeScript
Raw Normal View History

2018-06-05 05:10:41 +02:00
import { NgModule } from '@angular/core';
import {
RouterModule,
Routes,
} from '@angular/router';
2018-06-08 23:08:19 +02:00
import { FrontendLayoutComponent } from './layouts/frontend-layout.component';
import { OrganizationLayoutComponent } from './layouts/organization-layout.component';
import { UserLayoutComponent } from './layouts/user-layout.component';
2018-07-12 22:05:42 +02:00
import { AcceptOrganizationComponent } from './accounts/accept-organization.component';
2018-06-05 21:02:53 +02:00
import { HintComponent } from './accounts/hint.component';
import { LockComponent } from './accounts/lock.component';
2018-06-05 21:02:53 +02:00
import { LoginComponent } from './accounts/login.component';
2018-07-13 21:54:49 +02:00
import { RecoverDeleteComponent } from './accounts/recover-delete.component';
2018-07-13 21:36:27 +02:00
import { RecoverTwoFactorComponent } from './accounts/recover-two-factor.component';
2018-06-05 21:02:53 +02:00
import { RegisterComponent } from './accounts/register.component';
2020-08-19 17:15:04 +02:00
import { SetPasswordComponent } from './accounts/set-password.component';
import { SsoComponent } from './accounts/sso.component';
2018-06-05 21:02:53 +02:00
import { TwoFactorComponent } from './accounts/two-factor.component';
2018-07-12 20:19:47 +02:00
import { VerifyEmailTokenComponent } from './accounts/verify-email-token.component';
2018-07-13 22:24:53 +02:00
import { VerifyRecoverDeleteComponent } from './accounts/verify-recover-delete.component';
2018-06-05 21:02:53 +02:00
2018-07-06 16:21:08 +02:00
import { CollectionsComponent as OrgManageCollectionsComponent } from './organizations/manage/collections.component';
import { EventsComponent as OrgEventsComponent } from './organizations/manage/events.component';
import { GroupsComponent as OrgGroupsComponent } from './organizations/manage/groups.component';
import { ManageComponent as OrgManageComponent } from './organizations/manage/manage.component';
import { PeopleComponent as OrgPeopleComponent } from './organizations/manage/people.component';
2020-01-15 22:51:42 +01:00
import { PoliciesComponent as OrgPoliciesComponent } from './organizations/manage/policies.component';
2018-07-06 16:21:08 +02:00
2018-07-16 18:42:49 +02:00
import { AccountComponent as OrgAccountComponent } from './organizations/settings/account.component';
2018-07-16 23:17:07 +02:00
import { OrganizationBillingComponent } from './organizations/settings/organization-billing.component';
import { OrganizationSubscriptionComponent } from './organizations/settings/organization-subscription.component';
2018-07-16 18:42:49 +02:00
import { SettingsComponent as OrgSettingsComponent } from './organizations/settings/settings.component';
2018-07-18 23:10:26 +02:00
import {
TwoFactorSetupComponent as OrgTwoFactorSetupComponent,
} from './organizations/settings/two-factor-setup.component';
2018-07-16 18:42:49 +02:00
2018-07-05 20:40:53 +02:00
import { ExportComponent as OrgExportComponent } from './organizations/tools/export.component';
2018-12-14 19:56:01 +01:00
import {
ExposedPasswordsReportComponent as OrgExposedPasswordsReportComponent,
} from './organizations/tools/exposed-passwords-report.component';
2018-07-06 05:38:36 +02:00
import { ImportComponent as OrgImportComponent } from './organizations/tools/import.component';
2018-12-14 20:22:30 +01:00
import {
InactiveTwoFactorReportComponent as OrgInactiveTwoFactorReportComponent,
} from './organizations/tools/inactive-two-factor-report.component';
2018-12-14 20:42:04 +01:00
import {
ReusedPasswordsReportComponent as OrgReusedPasswordsReportComponent,
} from './organizations/tools/reused-passwords-report.component';
2018-07-05 20:40:53 +02:00
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
2018-12-14 20:42:04 +01:00
import {
UnsecuredWebsitesReportComponent as OrgUnsecuredWebsitesReportComponent,
} from './organizations/tools/unsecured-websites-report.component';
import {
WeakPasswordsReportComponent as OrgWeakPasswordsReportComponent,
} from './organizations/tools/weak-passwords-report.component';
2018-07-05 20:40:53 +02:00
import { VaultComponent as OrgVaultComponent } from './organizations/vault/vault.component';
2018-07-03 18:34:20 +02:00
2018-06-21 04:27:37 +02:00
import { AccountComponent } from './settings/account.component';
2018-07-02 23:09:53 +02:00
import { CreateOrganizationComponent } from './settings/create-organization.component';
2018-06-26 05:16:59 +02:00
import { DomainRulesComponent } from './settings/domain-rules.component';
2018-06-25 22:44:06 +02:00
import { OptionsComponent } from './settings/options.component';
import { OrganizationsComponent } from './settings/organizations.component';
import { PremiumComponent } from './settings/premium.component';
2018-06-21 04:27:37 +02:00
import { SettingsComponent } from './settings/settings.component';
2018-06-27 04:51:58 +02:00
import { TwoFactorSetupComponent } from './settings/two-factor-setup.component';
2018-06-28 20:05:04 +02:00
import { UserBillingComponent } from './settings/user-billing.component';
import { UserSubscriptionComponent } from './settings/user-subscription.component';
2018-06-21 04:27:37 +02:00
2018-06-28 17:58:33 +02:00
import { BreachReportComponent } from './tools/breach-report.component';
2018-06-10 05:33:12 +02:00
import { ExportComponent } from './tools/export.component';
2018-12-12 04:09:16 +01:00
import { ExposedPasswordsReportComponent } from './tools/exposed-passwords-report.component';
2018-06-10 05:33:12 +02:00
import { ImportComponent } from './tools/import.component';
2018-12-12 05:25:05 +01:00
import { InactiveTwoFactorReportComponent } from './tools/inactive-two-factor-report.component';
2018-06-21 00:16:20 +02:00
import { PasswordGeneratorComponent } from './tools/password-generator.component';
2018-12-11 20:47:41 +01:00
import { ReusedPasswordsReportComponent } from './tools/reused-passwords-report.component';
2018-06-10 05:33:12 +02:00
import { ToolsComponent } from './tools/tools.component';
2018-12-11 21:11:16 +01:00
import { UnsecuredWebsitesReportComponent } from './tools/unsecured-websites-report.component';
2018-12-11 23:49:51 +01:00
import { WeakPasswordsReportComponent } from './tools/weak-passwords-report.component';
2018-06-10 05:33:12 +02:00
2018-06-05 05:10:41 +02:00
import { VaultComponent } from './vault/vault.component';
2018-07-05 21:27:23 +02:00
import { OrganizationGuardService } from './services/organization-guard.service';
import { OrganizationTypeGuardService } from './services/organization-type-guard.service';
2018-06-10 04:02:45 +02:00
import { UnauthGuardService } from './services/unauth-guard.service';
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
2018-07-05 21:27:23 +02:00
import { OrganizationUserType } from 'jslib/enums/organizationUserType';
2018-06-05 05:10:41 +02:00
const routes: Routes = [
{
2018-06-08 23:08:19 +02:00
path: '',
2018-06-10 04:02:45 +02:00
component: FrontendLayoutComponent,
2018-06-08 23:08:19 +02:00
children: [
2018-06-10 04:02:45 +02:00
{ path: '', pathMatch: 'full', component: LoginComponent, canActivate: [UnauthGuardService] },
{ path: '2fa', component: TwoFactorComponent, canActivate: [UnauthGuardService] },
2018-07-06 04:37:35 +02:00
{
path: 'register', component: RegisterComponent,
canActivate: [UnauthGuardService],
data: { titleId: 'createAccount' },
},
{
path: 'sso', component: SsoComponent,
canActivate: [UnauthGuardService],
2020-08-20 22:39:05 +02:00
data: { titleId: 'enterpriseSingleSignOn' },
},
{
2020-08-19 17:15:04 +02:00
path: 'set-password', component: SetPasswordComponent,
data: { titleId: 'setMasterPassword' },
},
2018-07-06 04:37:35 +02:00
{
path: 'hint', component: HintComponent,
canActivate: [UnauthGuardService],
data: { titleId: 'passwordHint' },
},
2018-06-10 04:02:45 +02:00
{ path: 'lock', component: LockComponent },
2018-07-12 20:19:47 +02:00
{ path: 'verify-email', component: VerifyEmailTokenComponent },
2018-07-13 22:24:53 +02:00
{
path: 'accept-organization',
component: AcceptOrganizationComponent,
data: { titleId: 'joinOrganization' },
},
2018-07-13 21:36:27 +02:00
{ path: 'recover', pathMatch: 'full', redirectTo: 'recover-2fa' },
2018-07-13 22:24:53 +02:00
{
path: 'recover-2fa',
component: RecoverTwoFactorComponent,
canActivate: [UnauthGuardService],
data: { titleId: 'recoverAccountTwoStep' },
},
{
path: 'recover-delete',
component: RecoverDeleteComponent,
canActivate: [UnauthGuardService],
data: { titleId: 'deleteAccount' },
},
{
path: 'verify-recover-delete',
component: VerifyRecoverDeleteComponent,
canActivate: [UnauthGuardService],
data: { titleId: 'deleteAccount' },
},
2018-06-08 23:08:19 +02:00
],
},
{
path: '',
2018-06-10 04:02:45 +02:00
component: UserLayoutComponent,
2018-07-05 21:27:23 +02:00
canActivate: [AuthGuardService],
2018-06-08 23:08:19 +02:00
children: [
2018-07-06 04:37:35 +02:00
{ path: 'vault', component: VaultComponent, data: { titleId: 'myVault' } },
2018-06-21 04:27:37 +02:00
{
path: 'settings',
component: SettingsComponent,
children: [
{ path: '', pathMatch: 'full', redirectTo: 'account' },
2018-07-06 04:37:35 +02:00
{ path: 'account', component: AccountComponent, data: { titleId: 'myAccount' } },
{ path: 'options', component: OptionsComponent, data: { titleId: 'options' } },
{ path: 'domain-rules', component: DomainRulesComponent, data: { titleId: 'domainRules' } },
{ path: 'two-factor', component: TwoFactorSetupComponent, data: { titleId: 'twoStepLogin' } },
{ path: 'premium', component: PremiumComponent, data: { titleId: 'goPremium' } },
{ path: 'billing', component: UserBillingComponent, data: { titleId: 'billing' } },
{
path: 'subscription',
component: UserSubscriptionComponent,
data: { titleId: 'premiumMembership' },
},
2018-07-06 04:37:35 +02:00
{ path: 'organizations', component: OrganizationsComponent, data: { titleId: 'organizations' } },
{
path: 'create-organization',
component: CreateOrganizationComponent,
data: { titleId: 'newOrganization' },
},
2018-06-21 04:27:37 +02:00
],
},
2018-06-10 05:33:12 +02:00
{
path: 'tools',
component: ToolsComponent,
2018-07-05 21:27:23 +02:00
canActivate: [AuthGuardService],
2018-06-10 05:33:12 +02:00
children: [
2018-06-21 00:16:20 +02:00
{ path: '', pathMatch: 'full', redirectTo: 'generator' },
2018-07-06 04:37:35 +02:00
{ path: 'import', component: ImportComponent, data: { titleId: 'importData' } },
{ path: 'export', component: ExportComponent, data: { titleId: 'exportVault' } },
{
path: 'generator',
component: PasswordGeneratorComponent,
data: { titleId: 'passwordGenerator' },
},
{ path: 'breach-report', component: BreachReportComponent, data: { titleId: 'dataBreachReport' } },
2018-12-11 20:47:41 +01:00
{
path: 'reused-passwords-report',
component: ReusedPasswordsReportComponent,
data: { titleId: 'reusedPasswordsReport' },
},
2018-12-11 21:11:16 +01:00
{
path: 'unsecured-websites-report',
component: UnsecuredWebsitesReportComponent,
data: { titleId: 'unsecuredWebsitesReport' },
},
2018-12-11 23:49:51 +01:00
{
path: 'weak-passwords-report',
component: WeakPasswordsReportComponent,
data: { titleId: 'weakPasswordsReport' },
},
2018-12-12 04:09:16 +01:00
{
path: 'exposed-passwords-report',
component: ExposedPasswordsReportComponent,
data: { titleId: 'exposedPasswordsReport' },
2018-12-12 05:25:05 +01:00
},
{
path: 'inactive-two-factor-report',
component: InactiveTwoFactorReportComponent,
2018-12-14 20:22:30 +01:00
data: { titleId: 'inactive2faReport' },
2018-12-12 04:09:16 +01:00
},
2018-06-10 05:33:12 +02:00
],
},
2018-06-08 23:08:19 +02:00
],
},
{
2018-07-03 18:34:20 +02:00
path: 'organizations/:organizationId',
2018-06-08 23:08:19 +02:00
component: OrganizationLayoutComponent,
2018-07-05 21:27:23 +02:00
canActivate: [AuthGuardService, OrganizationGuardService],
2018-06-08 23:08:19 +02:00
children: [
2018-07-03 18:34:20 +02:00
{ path: '', pathMatch: 'full', redirectTo: 'vault' },
2018-07-06 04:37:35 +02:00
{ path: 'vault', component: OrgVaultComponent, data: { titleId: 'vault' } },
2018-07-05 20:40:53 +02:00
{
path: 'tools',
component: OrgToolsComponent,
2018-07-05 21:27:23 +02:00
canActivate: [OrganizationTypeGuardService],
data: { allowedTypes: [OrganizationUserType.Owner, OrganizationUserType.Admin] },
2018-07-05 20:40:53 +02:00
children: [
2018-07-06 05:44:58 +02:00
{ path: '', pathMatch: 'full', redirectTo: 'import' },
2018-07-06 05:38:36 +02:00
{ path: 'import', component: OrgImportComponent, data: { titleId: 'importData' } },
2018-07-06 04:37:35 +02:00
{ path: 'export', component: OrgExportComponent, data: { titleId: 'exportVault' } },
2018-12-14 19:56:01 +01:00
{
path: 'exposed-passwords-report',
component: OrgExposedPasswordsReportComponent,
data: { titleId: 'exposedPasswordsReport' },
},
2018-12-14 20:22:30 +01:00
{
path: 'inactive-two-factor-report',
component: OrgInactiveTwoFactorReportComponent,
data: { titleId: 'inactive2faReport' },
},
2018-12-14 20:42:04 +01:00
{
path: 'reused-passwords-report',
component: OrgReusedPasswordsReportComponent,
data: { titleId: 'reusedPasswordsReport' },
},
{
path: 'unsecured-websites-report',
component: OrgUnsecuredWebsitesReportComponent,
data: { titleId: 'unsecuredWebsitesReport' },
},
{
path: 'weak-passwords-report',
component: OrgWeakPasswordsReportComponent,
data: { titleId: 'weakPasswordsReport' },
},
2018-07-05 20:40:53 +02:00
],
},
2018-07-06 16:21:08 +02:00
{
path: 'manage',
component: OrgManageComponent,
canActivate: [OrganizationTypeGuardService],
data: {
allowedTypes: [
OrganizationUserType.Owner,
OrganizationUserType.Admin,
OrganizationUserType.Manager,
2018-10-17 17:23:01 +02:00
],
},
2018-07-06 16:21:08 +02:00
children: [
{ path: '', pathMatch: 'full', redirectTo: 'people' },
{ path: 'collections', component: OrgManageCollectionsComponent, data: { titleId: 'collections' } },
{ path: 'events', component: OrgEventsComponent, data: { titleId: 'eventLogs' } },
{ path: 'groups', component: OrgGroupsComponent, data: { titleId: 'groups' } },
{ path: 'people', component: OrgPeopleComponent, data: { titleId: 'people' } },
2020-01-15 22:51:42 +01:00
{ path: 'policies', component: OrgPoliciesComponent, data: { titleId: 'policies' } },
2018-07-06 16:21:08 +02:00
],
},
2018-07-16 18:42:49 +02:00
{
path: 'settings',
component: OrgSettingsComponent,
canActivate: [OrganizationTypeGuardService],
2018-07-17 21:57:04 +02:00
data: { allowedTypes: [OrganizationUserType.Owner] },
2018-07-16 18:42:49 +02:00
children: [
{ path: '', pathMatch: 'full', redirectTo: 'account' },
{ path: 'account', component: OrgAccountComponent, data: { titleId: 'myOrganization' } },
2018-07-18 23:10:26 +02:00
{ path: 'two-factor', component: OrgTwoFactorSetupComponent, data: { titleId: 'twoStepLogin' } },
2018-07-16 23:17:07 +02:00
{
path: 'billing',
component: OrganizationBillingComponent,
data: { titleId: 'billing' },
},
{
path: 'subscription',
component: OrganizationSubscriptionComponent,
data: { titleId: 'subscription' },
2018-07-16 23:17:07 +02:00
},
2018-07-16 18:42:49 +02:00
],
},
2018-06-08 23:08:19 +02:00
],
2018-06-05 05:10:41 +02:00
},
2018-06-08 23:08:19 +02:00
{ path: '**', redirectTo: '' },
2018-06-05 05:10:41 +02:00
];
@NgModule({
imports: [RouterModule.forRoot(routes, {
useHash: true,
/*enableTracing: true,*/
})],
exports: [RouterModule],
})
export class AppRoutingModule { }