From 5f1ad85dd123794d9b96e732b4b1761ddf0fdf59 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Thu, 20 May 2021 21:05:17 +1000 Subject: [PATCH] Fix lockGuard logic (#384) * Fix lockGuard logic * add missing return values --- src/angular/services/lock-guard.service.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/angular/services/lock-guard.service.ts b/src/angular/services/lock-guard.service.ts index 9e318ab86e..80e2981b63 100644 --- a/src/angular/services/lock-guard.service.ts +++ b/src/angular/services/lock-guard.service.ts @@ -13,17 +13,18 @@ export class LockGuardService implements CanActivate { private router: Router) { } async canActivate() { - const locked = await this.vaultTimeoutService.isLocked(); - if (!locked) { - const isAuthed = await this.userService.isAuthenticated(); - if (!isAuthed) { - this.router.navigate(['login']); + const isAuthed = await this.userService.isAuthenticated(); + if (isAuthed) { + const locked = await this.vaultTimeoutService.isLocked(); + if (locked) { + return true; } else { this.router.navigate(['vault']); + return false; } - return false; } - return true; + this.router.navigate(['']); + return false; } }