view account's fingerprint phrase

This commit is contained in:
Kyle Spearrin 2018-11-16 11:08:36 -05:00
parent f8d6c53142
commit 50dd2048ff
3 changed files with 38 additions and 3 deletions

View File

@ -121,8 +121,13 @@
"changeMasterPassword": {
"message": "Change Master Password"
},
"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."
},
"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."
},
"twoStepLogin": {
"message": "Two-step Login"

View File

@ -58,6 +58,11 @@
<div class="row-main">{{'changeMasterPassword' | i18n}}</div>
<i class="fa fa-chevron-right fa-lg row-sub-icon"></i>
</a>
<a class="box-content-row box-content-row-flex text-default" href="#"
appStopClick appBlurClick (click)="fingerprint()">
<div class="row-main">{{'fingerprintPhrase' | i18n}}</div>
<i class="fa fa-chevron-right fa-lg row-sub-icon"></i>
</a>
<a class="box-content-row box-content-row-flex text-default" href="#"
appStopClick appBlurClick (click)="logOut()">
<div class="row-main">{{'logOut' | i18n}}</div>

View File

@ -15,12 +15,14 @@ import { DeviceType } from 'jslib/enums/deviceType';
import { ConstantsService } from 'jslib/services/constants.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { LockService } from 'jslib/abstractions/lock.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { UserService } from 'jslib/abstractions/user.service';
const RateUrls = {
[DeviceType.ChromeExtension]:
@ -50,7 +52,8 @@ export class SettingsComponent implements OnInit {
constructor(private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
private analytics: Angulartics2, private lockService: LockService,
private storageService: StorageService, public messagingService: MessagingService,
private router: Router, private environmentService: EnvironmentService) {
private router: Router, private environmentService: EnvironmentService,
private cryptoService: CryptoService, private userService: UserService) {
}
async ngOnInit() {
@ -198,6 +201,28 @@ export class SettingsComponent implements OnInit {
});
}
async fingerprint() {
this.analytics.eventTrack.next({ action: 'Clicked Fingerprint' });
const fingerprint = await this.cryptoService.getFingerprint(await this.userService.getUserId());
const p = document.createElement('p');
p.innerText = this.i18nService.t('yourAccountsFingerprint') + ':';
const p2 = document.createElement('p');
p2.innerText = fingerprint.join('-');
const div = document.createElement('div');
div.appendChild(p);
div.appendChild(p2);
const result = await swal({
content: { element: div },
buttons: [this.i18nService.t('close'), this.i18nService.t('learnMore')],
});
if (result) {
this.platformUtilsService.launchUri('https://help.bitwarden.com');
}
}
rate() {
this.analytics.eventTrack.next({ action: 'Rate Extension' });
BrowserApi.createNewTab((RateUrls as any)[this.platformUtilsService.getDevice()]);