mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-28 12:45:45 +01:00
Reload browser extension after enabling nativeMessaging (#1577)
This commit is contained in:
parent
1d79172876
commit
14293a7831
@ -1438,6 +1438,12 @@
|
|||||||
"biometricsNotSupportedDesc": {
|
"biometricsNotSupportedDesc": {
|
||||||
"message": "Browser biometrics is not supported on this device."
|
"message": "Browser biometrics is not supported on this device."
|
||||||
},
|
},
|
||||||
|
"nativeMessagingPermissionPromptTitle": {
|
||||||
|
"message": "Additional Permission required"
|
||||||
|
},
|
||||||
|
"nativeMessagingPermissionPromptDesc": {
|
||||||
|
"message": "To enable browser biometrics we need to request an additional permission. Once allowed, the browser extension will reload and you may need to unlock your vault again."
|
||||||
|
},
|
||||||
"nativeMessaginPermissionErrorTitle": {
|
"nativeMessaginPermissionErrorTitle": {
|
||||||
"message": "Permission not provided"
|
"message": "Permission not provided"
|
||||||
},
|
},
|
||||||
|
@ -35,6 +35,11 @@ export class NativeMessagingBackground {
|
|||||||
private runtimeBackground: RuntimeBackground, private i18nService: I18nService, private userService: UserService,
|
private runtimeBackground: RuntimeBackground, private i18nService: I18nService, private userService: UserService,
|
||||||
private messagingService: MessagingService, private appIdService: AppIdService) {
|
private messagingService: MessagingService, private appIdService: AppIdService) {
|
||||||
this.storageService.save(ConstantsService.biometricFingerprintValidated, false);
|
this.storageService.save(ConstantsService.biometricFingerprintValidated, false);
|
||||||
|
|
||||||
|
// Reload extension to activate nativeMessaging
|
||||||
|
chrome.permissions.onAdded.addListener((permissions) => {
|
||||||
|
BrowserApi.reloadExtension(null);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
|
@ -214,16 +214,26 @@ export class SettingsComponent implements OnInit {
|
|||||||
|
|
||||||
// Request permission to use the optional permission for nativeMessaging
|
// Request permission to use the optional permission for nativeMessaging
|
||||||
if (!this.platformUtilsService.isFirefox()) {
|
if (!this.platformUtilsService.isFirefox()) {
|
||||||
const granted = await new Promise((resolve, reject) => {
|
const hasPermission = await new Promise((resolve) => {
|
||||||
chrome.permissions.request({permissions: ['nativeMessaging']}, resolve);
|
chrome.permissions.contains({permissions: ['nativeMessaging']}, resolve);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!granted) {
|
if (!hasPermission) {
|
||||||
await this.platformUtilsService.showDialog(
|
await this.platformUtilsService.showDialog(
|
||||||
this.i18nService.t('nativeMessaginPermissionErrorDesc'), this.i18nService.t('nativeMessaginPermissionErrorTitle'),
|
this.i18nService.t('nativeMessagingPermissionPromptDesc'), this.i18nService.t('nativeMessagingPermissionPromptTitle'),
|
||||||
this.i18nService.t('ok'), null);
|
this.i18nService.t('ok'), null);
|
||||||
this.biometric = false;
|
|
||||||
return;
|
const granted = await new Promise((resolve, reject) => {
|
||||||
|
chrome.permissions.request({permissions: ['nativeMessaging']}, resolve);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!granted) {
|
||||||
|
await this.platformUtilsService.showDialog(
|
||||||
|
this.i18nService.t('nativeMessaginPermissionErrorDesc'), this.i18nService.t('nativeMessaginPermissionErrorTitle'),
|
||||||
|
this.i18nService.t('ok'), null);
|
||||||
|
this.biometric = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user