1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 02:03:39 +00:00

[Auto-Logout] Refactor LockService and Update Dependencies (#91)

* initial commit for lockService name refactor

* Reverted ConstantsService vault timeout key to legacy string value

Co-authored-by: Vincent Salucci <vsalucci@bitwarden.com>
This commit is contained in:
Vincent Salucci
2020-03-27 09:03:27 -05:00
committed by GitHub
parent 31a257407b
commit 64c54cfb86
11 changed files with 48 additions and 35 deletions

View File

@@ -6,14 +6,14 @@ import {
RouterStateSnapshot,
} from '@angular/router';
import { LockService } from '../../abstractions/lock.service';
import { MessagingService } from '../../abstractions/messaging.service';
import { UserService } from '../../abstractions/user.service';
import { VaultTimeoutService } from '../../abstractions/vaultTimeout.service';
@Injectable()
export class AuthGuardService implements CanActivate {
constructor(private lockService: LockService, private userService: UserService, private router: Router,
private messagingService: MessagingService) { }
constructor(private vaultTimeoutService: VaultTimeoutService, private userService: UserService,
private router: Router, private messagingService: MessagingService) { }
async canActivate(route: ActivatedRouteSnapshot, routerState: RouterStateSnapshot) {
const isAuthed = await this.userService.isAuthenticated();
@@ -22,7 +22,7 @@ export class AuthGuardService implements CanActivate {
return false;
}
const locked = await this.lockService.isLocked();
const locked = await this.vaultTimeoutService.isLocked();
if (locked) {
if (routerState != null) {
this.messagingService.send('lockedUrl', { url: routerState.url });