From 65bd33d860f3af71968a15e78491221091c4369e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 7 Jan 2019 23:30:04 -0500 Subject: [PATCH] expose email on init --- src/angular/components/lock.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/angular/components/lock.component.ts b/src/angular/components/lock.component.ts index 6e8caea78a..8ebc938e01 100644 --- a/src/angular/components/lock.component.ts +++ b/src/angular/components/lock.component.ts @@ -1,3 +1,4 @@ +import { OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { CryptoService } from '../../abstractions/crypto.service'; @@ -6,9 +7,10 @@ import { MessagingService } from '../../abstractions/messaging.service'; import { PlatformUtilsService } from '../../abstractions/platformUtils.service'; import { UserService } from '../../abstractions/user.service'; -export class LockComponent { +export class LockComponent implements OnInit { masterPassword: string = ''; showPassword: boolean = false; + email: string; protected successRoute: string = 'vault'; protected onSuccessfulSubmit: () => void; @@ -17,6 +19,10 @@ export class LockComponent { protected platformUtilsService: PlatformUtilsService, protected messagingService: MessagingService, protected userService: UserService, protected cryptoService: CryptoService) { } + async ngOnInit() { + this.email = await this.userService.getEmail(); + } + async submit() { if (this.masterPassword == null || this.masterPassword === '') { this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'), @@ -24,10 +30,9 @@ export class LockComponent { return; } - const email = await this.userService.getEmail(); const kdf = await this.userService.getKdf(); const kdfIterations = await this.userService.getKdfIterations(); - const key = await this.cryptoService.makeKey(this.masterPassword, email, kdf, kdfIterations); + const key = await this.cryptoService.makeKey(this.masterPassword, this.email, kdf, kdfIterations); const keyHash = await this.cryptoService.hashPassword(this.masterPassword, key); const storedKeyHash = await this.cryptoService.getKeyHash();