Merge pull request #847 from bitwarden/unauth-unlock-guards
Add unauthGuard and lockGuard to prevent unintended navigation
This commit is contained in:
commit
f7d2ab7d97
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit 3c872e56f27ae78fb922b765d7601886b5c39f78
|
||||
Subproject commit 36641f07b9807d90270ccd743d16b903cb558078
|
|
@ -5,6 +5,8 @@ import {
|
|||
} from '@angular/router';
|
||||
|
||||
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
|
||||
import { LockGuardService } from 'jslib/angular/services/lock-guard.service';
|
||||
import { UnauthGuardService } from 'jslib/angular/services/unauth-guard.service';
|
||||
|
||||
import { HintComponent } from './accounts/hint.component';
|
||||
import { LockComponent } from './accounts/lock.component';
|
||||
|
@ -20,8 +22,17 @@ import { VaultComponent } from './vault/vault.component';
|
|||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: '/vault', pathMatch: 'full' },
|
||||
{ path: 'lock', component: LockComponent },
|
||||
{ path: 'login', component: LoginComponent },
|
||||
{
|
||||
path: 'lock',
|
||||
component: LockComponent,
|
||||
canActivate: [LockGuardService],
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
component: LoginComponent,
|
||||
canActivate: [UnauthGuardService],
|
||||
|
||||
},
|
||||
{ path: '2fa', component: TwoFactorComponent },
|
||||
{ path: 'register', component: RegisterComponent },
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@ import { NativeMessagingService } from '../services/nativeMessaging.service';
|
|||
|
||||
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
|
||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||
import { LockGuardService } from 'jslib/angular/services/lock-guard.service';
|
||||
import { UnauthGuardService } from 'jslib/angular/services/unauth-guard.service';
|
||||
import { ValidationService } from 'jslib/angular/services/validation.service';
|
||||
|
||||
import { ApiService } from 'jslib/services/api.service';
|
||||
|
@ -186,6 +188,8 @@ export function initFactory(): Function {
|
|||
providers: [
|
||||
ValidationService,
|
||||
AuthGuardService,
|
||||
UnauthGuardService,
|
||||
LockGuardService,
|
||||
{ provide: AuditServiceAbstraction, useValue: auditService },
|
||||
{ provide: AuthServiceAbstraction, useValue: authService },
|
||||
{ provide: CipherServiceAbstraction, useValue: cipherService },
|
||||
|
|
Loading…
Reference in New Issue