1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

Make nativeMessaging optional on all platforms except firefox (#1565)

Make nativeMessaging optional on all platforms except firefox
This commit is contained in:
Oscar Hinton
2021-01-25 17:24:33 +01:00
committed by GitHub
parent c6af9266b7
commit 54da244340
3 changed files with 36 additions and 0 deletions

View File

@@ -1438,6 +1438,12 @@
"biometricsNotSupportedDesc": {
"message": "Browser biometrics is not supported on this device."
},
"nativeMessaginPermissionErrorTitle": {
"message": "Permission not provided"
},
"nativeMessaginPermissionErrorDesc": {
"message": "Without permission to communicate with the Bitwarden Desktop Application we cannot provide biometrics in the browser extension. Please try again."
},
"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."
},

View File

@@ -23,6 +23,7 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { UserService } from 'jslib/abstractions/user.service';
import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
import { resolve } from '@angular/compiler-cli/src/ngtsc/file_system';
const RateUrls = {
[DeviceType.ChromeExtension]:
@@ -208,6 +209,24 @@ export class SettingsComponent implements OnInit {
async updateBiometric() {
if (this.biometric) {
// Request permission to use the optional permission for nativeMessaging
if (!this.platformUtilsService.isFirefox()) {
const granted = await new Promise((resolve, reject) => {
chrome.permissions.request({permissions: ['nativeMessaging']}, function(granted) {
resolve(granted);
});
});
if (!granted) {
await this.platformUtilsService.showDialog(
this.i18nService.t('nativeMessaginPermissionErrorDesc'), this.i18nService.t('nativeMessaginPermissionErrorTitle'),
this.i18nService.t('ok'), null);
this.biometric = false;
return;
}
}
const submitted = Swal.fire({
heightAuto: false,
buttonsStyling: false,