1
0
mirror of https://github.com/bitwarden/web synced 2025-12-11 22:03:21 +00:00

auth guards

This commit is contained in:
Kyle Spearrin
2018-06-09 22:02:45 -04:00
parent 9f1c7a0a32
commit 7ebd18b00d
8 changed files with 67 additions and 19 deletions

View File

@@ -16,31 +16,34 @@ import { TwoFactorComponent } from './accounts/two-factor.component';
import { VaultComponent } from './vault/vault.component';
import { UnauthGuardService } from './services/unauth-guard.service';
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
const routes: Routes = [
{
path: '',
component: UserLayoutComponent,
children: [
{ path: '', redirectTo: 'vault', pathMatch: 'full' },
{ path: 'vault', component: VaultComponent },
],
},
{
path: '',
component: FrontendLayoutComponent,
children: [
{ path: 'login', component: LoginComponent },
{ path: '2fa', component: TwoFactorComponent },
{ path: 'register', component: RegisterComponent },
{ path: 'hint', component: HintComponent },
{ path: '', pathMatch: 'full', component: LoginComponent, canActivate: [UnauthGuardService] },
{ path: '2fa', component: TwoFactorComponent, canActivate: [UnauthGuardService] },
{ path: 'register', component: RegisterComponent, canActivate: [UnauthGuardService] },
{ path: 'hint', component: HintComponent, canActivate: [UnauthGuardService] },
{ path: 'lock', component: LockComponent },
],
},
{
path: '',
component: UserLayoutComponent,
children: [
{ path: 'vault', component: VaultComponent, canActivate: [AuthGuardService] },
],
},
{
path: 'organization/:organizationId',
component: OrganizationLayoutComponent,
children: [
{ path: 'vault', component: VaultComponent },
{ path: 'vault', component: VaultComponent, canActivate: [AuthGuardService] },
],
},
{ path: '**', redirectTo: '' },