1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

hasEncKey checks

This commit is contained in:
Kyle Spearrin 2018-07-12 17:09:09 -04:00
parent ba2debf577
commit 1dc4f851cb
4 changed files with 9 additions and 8 deletions

2
jslib

@ -1 +1 @@
Subproject commit 5fac06771310a083a004542db4c67028308f40c9
Subproject commit cc6f732a140e5f49f0c2fe22c34da660ffe5ea89

View File

@ -30,8 +30,8 @@ export class ChangeEmailComponent {
private cryptoService: CryptoService, private messagingService: MessagingService) { }
async submit() {
const hasKey = await this.cryptoService.hasKey();
if (!hasKey) {
const hasEncKey = await this.cryptoService.hasEncKey();
if (!hasEncKey) {
this.toasterService.popAsync('error', null, this.i18nService.t('updateKey'));
return;
}

View File

@ -28,8 +28,8 @@ export class ChangePasswordComponent {
private userService: UserService) { }
async submit() {
const hasKey = await this.cryptoService.hasKey();
if (!hasKey) {
const hasEncKey = await this.cryptoService.hasEncKey();
if (!hasEncKey) {
this.toasterService.popAsync('error', null, this.i18nService.t('updateKey'));
return;
}

View File

@ -29,8 +29,8 @@ import { FolderAddEditComponent } from './folder-add-edit.component';
import { GroupingsComponent } from './groupings.component';
import { ShareComponent } from './share.component';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { SyncService } from 'jslib/abstractions/sync.service';
import { TokenService } from 'jslib/abstractions/token.service';
@ -64,12 +64,13 @@ export class VaultComponent implements OnInit {
constructor(private syncService: SyncService, private route: ActivatedRoute,
private router: Router, private location: Location,
private i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver,
private tokenService: TokenService, private storageService: StorageService) { }
private tokenService: TokenService, private cryptoService: CryptoService) { }
async ngOnInit() {
this.showVerifyEmail = !(await this.tokenService.getEmailVerified());
this.showBrowserOutdated = window.navigator.userAgent.indexOf('MSIE') !== -1;
this.showUpdateKey = !this.showVerifyEmail && (await this.storageService.get<string>('encKey')) == null;
const hasEncKey = await this.cryptoService.hasEncKey();
this.showUpdateKey = !this.showVerifyEmail && hasEncKey;
this.route.queryParams.subscribe(async (params) => {
await this.syncService.fullSync(false);