diff --git a/src/app/accounts/hint.component.html b/src/app/accounts/hint.component.html index 0e7fab7d6f..b56867f95d 100644 --- a/src/app/accounts/hint.component.html +++ b/src/app/accounts/hint.component.html @@ -15,7 +15,7 @@ {{'submit' | i18n}} - + {{'cancel' | i18n}} diff --git a/src/app/accounts/lock.component.ts b/src/app/accounts/lock.component.ts index 39fced9b16..80727dc74e 100644 --- a/src/app/accounts/lock.component.ts +++ b/src/app/accounts/lock.component.ts @@ -1,4 +1,7 @@ -import { Component } from '@angular/core'; +import { + Component, + OnInit, +} from '@angular/core'; import { Router } from '@angular/router'; import { ToasterService } from 'angular2-toaster'; @@ -16,7 +19,7 @@ import { LockComponent as BaseLockComponent } from 'jslib/angular/components/loc selector: 'app-lock', templateUrl: 'lock.component.html', }) -export class LockComponent extends BaseLockComponent { +export class LockComponent extends BaseLockComponent implements OnInit { constructor(router: Router, analytics: Angulartics2, toasterService: ToasterService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, messagingService: MessagingService, @@ -24,4 +27,14 @@ export class LockComponent extends BaseLockComponent { super(router, analytics, toasterService, i18nService, platformUtilsService, messagingService, userService, cryptoService); } + + async ngOnInit() { + const authed = await this.userService.isAuthenticated(); + const key = await this.cryptoService.getKey(); + if (!authed) { + this.router.navigate(['/']); + } else if (key != null) { + this.router.navigate(['vault']); + } + } } diff --git a/src/app/accounts/register.component.html b/src/app/accounts/register.component.html index b1ae508c54..199155b5ec 100644 --- a/src/app/accounts/register.component.html +++ b/src/app/accounts/register.component.html @@ -41,7 +41,7 @@ {{'submit' | i18n}} - + {{'cancel' | i18n}} diff --git a/src/app/accounts/two-factor.component.html b/src/app/accounts/two-factor.component.html index e4acd405cc..404f865e8e 100644 --- a/src/app/accounts/two-factor.component.html +++ b/src/app/accounts/two-factor.component.html @@ -1,7 +1,7 @@