1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

send lockedUrl message

This commit is contained in:
Kyle Spearrin
2019-02-22 13:16:12 -05:00
parent 3362334d2c
commit 2b575f0c60

View File

@@ -1,7 +1,9 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { import {
ActivatedRouteSnapshot,
CanActivate, CanActivate,
Router, Router,
RouterStateSnapshot,
} from '@angular/router'; } from '@angular/router';
import { LockService } from '../../abstractions/lock.service'; import { LockService } from '../../abstractions/lock.service';
@@ -13,7 +15,7 @@ export class AuthGuardService implements CanActivate {
constructor(private lockService: LockService, private userService: UserService, private router: Router, constructor(private lockService: LockService, private userService: UserService, private router: Router,
private messagingService: MessagingService) { } private messagingService: MessagingService) { }
async canActivate() { async canActivate(route: ActivatedRouteSnapshot, routerState: RouterStateSnapshot) {
const isAuthed = await this.userService.isAuthenticated(); const isAuthed = await this.userService.isAuthenticated();
if (!isAuthed) { if (!isAuthed) {
this.messagingService.send('logout'); this.messagingService.send('logout');
@@ -22,6 +24,9 @@ export class AuthGuardService implements CanActivate {
const locked = await this.lockService.isLocked(); const locked = await this.lockService.isLocked();
if (locked) { if (locked) {
if (routerState != null) {
this.messagingService.send('lockedUrl', { url: routerState.url });
}
this.router.navigate(['lock']); this.router.navigate(['lock']);
return false; return false;
} }