diff --git a/src/app/accounts/lock.component.ts b/src/app/accounts/lock.component.ts index c5daf754b5..70cec1bec6 100644 --- a/src/app/accounts/lock.component.ts +++ b/src/app/accounts/lock.component.ts @@ -33,10 +33,9 @@ export class LockComponent extends BaseLockComponent implements OnInit { async ngOnInit() { const authed = await this.userService.isAuthenticated(); - const key = await this.cryptoService.getKey(); if (!authed) { this.router.navigate(['/']); - } else if (key != null) { + } else if (await this.cryptoService.hasKey()) { this.router.navigate(['vault']); } diff --git a/src/app/services/unauth-guard.service.ts b/src/app/services/unauth-guard.service.ts index 3c89f26d4a..3b86cd6042 100644 --- a/src/app/services/unauth-guard.service.ts +++ b/src/app/services/unauth-guard.service.ts @@ -15,8 +15,8 @@ export class UnauthGuardService implements CanActivate { async canActivate() { const isAuthed = await this.userService.isAuthenticated(); if (isAuthed) { - const key = await this.cryptoService.getKey(); - if (key == null) { + const hasKey = await this.cryptoService.hasKey(); + if (!hasKey) { this.router.navigate(['lock']); } else { this.router.navigate(['vault']);