mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 10:13:31 +00:00
Merge pull request #1570 from bitwarden/hotfix/biometric-ff
Remove nativeMessaging requirement from Firefox
This commit is contained in:
@@ -89,7 +89,9 @@
|
||||
"http://*/*",
|
||||
"https://*/*",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"webRequestBlocking"
|
||||
],
|
||||
"optional_permissions": [
|
||||
"nativeMessaging"
|
||||
],
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<label for="pin">{{'unlockWithPin' | i18n}}</label>
|
||||
<input id="pin" type="checkbox" (change)="updatePin()" [(ngModel)]="pin">
|
||||
</div>
|
||||
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
||||
<div class="box-content-row box-content-row-checkbox" appBoxRow *ngIf="supportsBiometric">
|
||||
<label for="biometric">{{'unlockWithBiometrics' | i18n}}</label>
|
||||
<input id="biometric" type="checkbox" (change)="updateBiometric()" [(ngModel)]="biometric">
|
||||
</div>
|
||||
|
||||
@@ -23,7 +23,6 @@ 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]:
|
||||
@@ -52,6 +51,7 @@ export class SettingsComponent implements OnInit {
|
||||
vaultTimeoutActions: any[];
|
||||
vaultTimeoutAction: string;
|
||||
pin: boolean = null;
|
||||
supportsBiometric: boolean;
|
||||
biometric: boolean = false;
|
||||
previousVaultTimeout: number = null;
|
||||
|
||||
@@ -102,6 +102,8 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
const pinSet = await this.vaultTimeoutService.isPinLockSet();
|
||||
this.pin = pinSet[0] || pinSet[1];
|
||||
|
||||
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
|
||||
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
|
||||
}
|
||||
|
||||
@@ -208,16 +210,14 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
async updateBiometric() {
|
||||
if (this.biometric) {
|
||||
if (this.biometric && this.supportsBiometric) {
|
||||
|
||||
// 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);
|
||||
});
|
||||
chrome.permissions.request({permissions: ['nativeMessaging']}, resolve);
|
||||
});
|
||||
|
||||
|
||||
if (!granted) {
|
||||
await this.platformUtilsService.showDialog(
|
||||
this.i18nService.t('nativeMessaginPermissionErrorDesc'), this.i18nService.t('nativeMessaginPermissionErrorTitle'),
|
||||
|
||||
@@ -290,7 +290,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
||||
}
|
||||
|
||||
supportsBiometric() {
|
||||
return Promise.resolve(true);
|
||||
return Promise.resolve(!this.isFirefox() && !this.isSafari());
|
||||
}
|
||||
|
||||
authenticateBiometric() {
|
||||
|
||||
Reference in New Issue
Block a user