From 0511905ab46e868ca4c0d79b735eee3deaa671ce Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 15 Jan 2021 16:44:27 +0100 Subject: [PATCH] Handle desktop logged into a different account for biometrics (#1533) --- src/_locales/en/messages.json | 6 ++++++ src/background/nativeMessaging.background.ts | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index cdcbd64736..a1b4aa76d2 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -1420,6 +1420,12 @@ "nativeMessagingInvalidEncryptionTitle": { "message": "Desktop communication interrupted" }, + "nativeMessagingWrongUserDesc": { + "message": "The desktop application is logged into a different account. Please ensure both applications are logged into the same account." + }, + "nativeMessagingWrongUserTitle": { + "message": "Account missmatch" + }, "biometricsNotEnabledTitle": { "message": "Biometrics not enabled" }, diff --git a/src/background/nativeMessaging.background.ts b/src/background/nativeMessaging.background.ts index b83397e647..f1bcdf148a 100644 --- a/src/background/nativeMessaging.background.ts +++ b/src/background/nativeMessaging.background.ts @@ -106,6 +106,13 @@ export class NativeMessagingBackground { } break; } + case 'wrongUserId': + this.messagingService.send('showDialog', { + text: this.i18nService.t('nativeMessagingWrongUserDesc'), + title: this.i18nService.t('nativeMessagingWrongUserTitle'), + confirmText: this.i18nService.t('ok'), + type: 'error', + }); default: // Ignore since it belongs to another device if (message.appId !== this.appId) { @@ -247,7 +254,11 @@ export class NativeMessagingBackground { this.publicKey = publicKey; this.privateKey = privateKey; - this.sendUnencrypted({command: 'setupEncryption', publicKey: Utils.fromBufferToB64(publicKey)}); + this.sendUnencrypted({ + command: 'setupEncryption', + publicKey: Utils.fromBufferToB64(publicKey), + userId: await this.userService.getUserId() + }); return new Promise((resolve, reject) => this.secureSetupResolve = resolve); }