From 1e7c3c058c43c8fcddd637eafb3cbcec9ae64c3e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 16 Nov 2018 10:34:31 -0500 Subject: [PATCH] show fingerprint phrase menu option --- src/app/app.component.ts | 15 ++++++++++++++- src/locales/en/messages.json | 10 ++++++---- src/main/menu.main.ts | 29 ++++++++--------------------- 3 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2f72984f..3deb9385 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -39,6 +39,7 @@ import { LockService } from 'jslib/abstractions/lock.service'; import { MessagingService } from 'jslib/abstractions/messaging.service'; import { NotificationsService } from 'jslib/abstractions/notifications.service'; import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { SearchService } from 'jslib/abstractions/search.service'; import { SettingsService } from 'jslib/abstractions/settings.service'; import { StorageService } from 'jslib/abstractions/storage.service'; @@ -89,7 +90,8 @@ export class AppComponent implements OnInit { private lockService: LockService, private storageService: StorageService, private cryptoService: CryptoService, private componentFactoryResolver: ComponentFactoryResolver, private messagingService: MessagingService, private collectionService: CollectionService, - private searchService: SearchService, private notificationsService: NotificationsService) { } + private searchService: SearchService, private notificationsService: NotificationsService, + private platformUtilsService: PlatformUtilsService) { } ngOnInit() { this.ngZone.runOutsideAngular(() => { @@ -135,6 +137,17 @@ export class AppComponent implements OnInit { case 'openPremium': this.openModal(PremiumComponent, this.premiumRef); break; + case 'showFingerprintPhrase': + const fingerprint = await this.cryptoService.getFingerprint( + await this.userService.getUserId()); + const result = await this.platformUtilsService.showDialog( + this.i18nService.t('yourAccountsFingerprint') + ': ' + fingerprint.join('-'), + this.i18nService.t('fingerprintPhrase'), this.i18nService.t('learnMore'), + this.i18nService.t('close')); + if (result) { + this.platformUtilsService.launchUri('https://help.bitwarden.com'); + } + break; case 'openPasswordHistory': this.openModal( PasswordGeneratorHistoryComponent, this.passwordHistoryRef); diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index cb95e5c6..c7a975d4 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -705,11 +705,13 @@ "changeMasterPasswordConfirmation": { "message": "You can change your master password on the bitwarden.com web vault. Do you want to visit the website now?" }, - "changeEmail": { - "message": "Change Email" + "fingerprintPhrase": { + "message": "Fingerprint Phrase", + "description": "A 'fingerprint phrase' is a unique word phrase (similar to a passphrase) that a user can use to authenticate their public key with another user, for the purposes of sharing." }, - "changeEmailConfirmation": { - "message": "You can change your email address on the bitwarden.com web vault. Do you want to visit the website now?" + "yourAccountsFingerprint": { + "message": "Your account's fingerprint phrase", + "description": "A 'fingerprint phrase' is a unique word phrase (similar to a passphrase) that a user can use to authenticate their public key with another user, for the purposes of sharing." }, "goToWebVault": { "message": "Go To Web Vault" diff --git a/src/main/menu.main.ts b/src/main/menu.main.ts index c7aa9a28..c0008e72 100644 --- a/src/main/menu.main.ts +++ b/src/main/menu.main.ts @@ -30,7 +30,7 @@ export class MenuMain extends BaseMenu { lockNow: MenuItem; logOut: MenuItem; twoStepLogin: MenuItem; - changeEmail: MenuItem; + fingerprintPhrase: MenuItem; changeMasterPass: MenuItem; premiumMembership: MenuItem; passwordGenerator: MenuItem; @@ -57,7 +57,7 @@ export class MenuMain extends BaseMenu { this.lockNow = this.menu.getMenuItemById('lockNow'); this.logOut = this.menu.getMenuItemById('logOut'); this.twoStepLogin = this.menu.getMenuItemById('twoStepLogin'); - this.changeEmail = this.menu.getMenuItemById('changeEmail'); + this.fingerprintPhrase = this.menu.getMenuItemById('fingerprintPhrase'); this.changeMasterPass = this.menu.getMenuItemById('changeMasterPass'); this.premiumMembership = this.menu.getMenuItemById('premiumMembership'); this.passwordGenerator = this.menu.getMenuItemById('passwordGenerator'); @@ -66,7 +66,7 @@ export class MenuMain extends BaseMenu { this.unlockedRequiredMenuItems = [ this.addNewLogin, this.addNewItem, this.addNewFolder, - this.syncVault, this.exportVault, this.settings, this.lockNow, this.twoStepLogin, this.changeEmail, + this.syncVault, this.exportVault, this.settings, this.lockNow, this.twoStepLogin, this.fingerprintPhrase, this.changeMasterPass, this.premiumMembership, this.passwordGenerator, this.passwordHistory, this.searchVault]; this.updateApplicationMenuState(false, true); @@ -100,24 +100,6 @@ export class MenuMain extends BaseMenu { } }, }, - { - label: this.main.i18nService.t('changeEmail'), - id: 'changeEmail', - click: async () => { - const result = dialog.showMessageBox(this.main.windowMain.win, { - title: this.main.i18nService.t('changeEmail'), - message: this.main.i18nService.t('changeEmail'), - detail: this.main.i18nService.t('changeEmailConfirmation'), - buttons: [this.main.i18nService.t('yes'), this.main.i18nService.t('no')], - cancelId: 1, - defaultId: 0, - noLink: true, - }); - if (result === 0) { - await this.openWebVault(); - } - }, - }, { label: this.main.i18nService.t('twoStepLogin'), id: 'twoStepLogin', @@ -136,6 +118,11 @@ export class MenuMain extends BaseMenu { } }, }, + { + label: this.main.i18nService.t('fingerprintPhrase'), + id: 'fingerprintPhrase', + click: () => this.main.messagingService.send('showFingerprintPhrase'), + }, { type: 'separator' }, { label: this.i18nService.t('logOut'),