From 95d475a9d3561f058bd80aacaa360229fd52ac9f Mon Sep 17 00:00:00 2001 From: Hinton Date: Wed, 16 Dec 2020 17:32:51 +0100 Subject: [PATCH] Show an error when biometrics is disabeld in desktop app or not supported --- src/_locales/en/messages.json | 12 ++++++++++++ src/background/nativeMessaging.background.ts | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 6db7940fe1..3bc78c2382 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -1417,6 +1417,18 @@ "nativeMessagingInvalidEncryptionTitle": { "message": "Desktop communication interupted" }, + "biometricsNotEnabledTitle": { + "message": "Biometrics not enabled" + }, + "biometricsNotEnabledDesc": { + "message": "Browser biometric requires desktop biometric to be enabled in the settings first." + }, + "biometricsNotSupportedTitle": { + "message": "Biometrics not supported" + }, + "biometricsNotSupportedDesc": { + "message": "Browser biometric is not supported on this device." + }, "personalOwnershipSubmitError": { "message": "Due to an Enterprise Policy, you are restricted from saving items to your personal vault. Change the Ownership option to an organization and choose from available Collections." } diff --git a/src/background/nativeMessaging.background.ts b/src/background/nativeMessaging.background.ts index 6cebf49dfd..c8b8713861 100644 --- a/src/background/nativeMessaging.background.ts +++ b/src/background/nativeMessaging.background.ts @@ -159,6 +159,24 @@ export class NativeMessagingBackground { case 'biometricUnlock': await this.storageService.remove(ConstantsService.biometricAwaitingAcceptance); + if (message.response === 'not enabled') { + this.messagingService.send('showDialog', { + text: this.i18nService.t('biometricsNotEnabledDesc'), + title: this.i18nService.t('biometricsNotEnabledTitle'), + confirmText: this.i18nService.t('ok'), + type: 'error', + }); + break; + } else if (message.response === 'not supported') { + this.messagingService.send('showDialog', { + text: this.i18nService.t('biometricsNotSupportedDesc'), + title: this.i18nService.t('biometricsNotSupportedTitle'), + confirmText: this.i18nService.t('ok'), + type: 'error', + }); + break; + } + const enabled = await this.storageService.get(ConstantsService.biometricUnlockKey); if (enabled === null || enabled === false) { if (message.response === 'unlocked') {