2018-06-10 04:02:45 +02:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnInit,
|
|
|
|
} from '@angular/core';
|
2018-06-09 19:59:09 +02:00
|
|
|
import { Router } from '@angular/router';
|
|
|
|
|
|
|
|
import { ToasterService } from 'angular2-toaster';
|
|
|
|
import { Angulartics2 } from 'angulartics2';
|
|
|
|
|
|
|
|
import { CryptoService } from 'jslib/abstractions/crypto.service';
|
|
|
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
|
|
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
|
|
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
|
|
|
import { UserService } from 'jslib/abstractions/user.service';
|
|
|
|
|
|
|
|
import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-lock',
|
|
|
|
templateUrl: 'lock.component.html',
|
|
|
|
})
|
2018-06-10 04:02:45 +02:00
|
|
|
export class LockComponent extends BaseLockComponent implements OnInit {
|
2018-06-09 19:59:09 +02:00
|
|
|
constructor(router: Router, analytics: Angulartics2,
|
|
|
|
toasterService: ToasterService, i18nService: I18nService,
|
|
|
|
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
|
|
|
|
userService: UserService, cryptoService: CryptoService) {
|
|
|
|
super(router, analytics, toasterService, i18nService, platformUtilsService,
|
|
|
|
messagingService, userService, cryptoService);
|
|
|
|
}
|
2018-06-10 04:02:45 +02:00
|
|
|
|
|
|
|
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']);
|
|
|
|
}
|
|
|
|
}
|
2018-06-09 19:59:09 +02:00
|
|
|
}
|