mirror of https://github.com/keeweb/keeweb
added a warning about Input Monitoring for mac
parent
4b52280549
commit
448e173f7e
|
@ -105,7 +105,7 @@ const ChalRespCalculator = {
|
|||
let deviceEnumerationTimer;
|
||||
|
||||
const onUsbDevicesChanged = () => {
|
||||
if (UsbListener.attachedYubiKeys === 0) {
|
||||
if (UsbListener.attachedYubiKeys.length === 0) {
|
||||
return;
|
||||
}
|
||||
deviceEnumerationTimer = setTimeout(() => {
|
||||
|
|
|
@ -9,7 +9,7 @@ const logger = new Logger('usb-listener');
|
|||
|
||||
const UsbListener = {
|
||||
supported: Features.isDesktop,
|
||||
attachedYubiKeys: 0,
|
||||
attachedYubiKeys: [],
|
||||
|
||||
init() {
|
||||
if (!this.supported) {
|
||||
|
|
|
@ -236,7 +236,8 @@
|
|||
"openChalRespHeader": "Challenge-Response",
|
||||
"openChalRespLoading": "Loading the list of YubiKeys",
|
||||
"openChalRespSelectYubiKey": "Select a YubiKey that you would like to use",
|
||||
"openChalRespErrorEmpty": "No YubiKeys found",
|
||||
"openChalRespErrorEmpty": "No YubiKeys found.",
|
||||
"openChalRespErrorEmptyMac": "First time using this feature on macOS? KeeWeb must be added to the Input Monitoring section of security settings.",
|
||||
|
||||
"detAttDownload": "Shift-click the attachment button to download it or",
|
||||
"detAttDelToRemove": "Delete to remove",
|
||||
|
@ -536,6 +537,7 @@
|
|||
"setFileRefreshYubiKeyList": "Refresh the list",
|
||||
"setFileYubiKeyHeader": "YubiKey",
|
||||
"setFileYubiKeyBody": "Using a YubiKey as a part of master key is dangerous and you may lose access to your passwords if something goes wrong. Have you made a backup of your file before changing this setting?",
|
||||
"setFileYubiKeyErrorEmptyMac": "Looks like there's a YubiKey plugged in, but it's not visible. KeeWeb must be added to the Input Monitoring section of security settings to access YubiKeys.",
|
||||
|
||||
"setShTitle": "Shortcuts",
|
||||
"setShShowAll": "show all items",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Events } from 'framework/events';
|
||||
import { View } from 'framework/views/view';
|
||||
import { YubiKey } from 'comp/app/yubikey';
|
||||
import { Features } from 'util/features';
|
||||
import { Locale } from 'util/locale';
|
||||
import { Timeouts } from 'const/timeouts';
|
||||
import template from 'templates/open-chal-resp.hbs';
|
||||
|
@ -23,12 +24,14 @@ class OpenChalRespView extends View {
|
|||
render() {
|
||||
let error = this.error;
|
||||
|
||||
if (this.yubiKeys && !this.yubiKeys.length) {
|
||||
const isEmpty = this.yubiKeys && !this.yubiKeys.length;
|
||||
if (isEmpty) {
|
||||
error = Locale.openChalRespErrorEmpty;
|
||||
}
|
||||
|
||||
super.render({
|
||||
error,
|
||||
showEmptyMacWarning: isEmpty && Features.isMac,
|
||||
yubiKeys: this.yubiKeys,
|
||||
loading: !this.yubiKeys && !this.error
|
||||
});
|
||||
|
|
|
@ -12,6 +12,7 @@ import { DateFormat } from 'util/formatting/date-format';
|
|||
import { UrlFormat } from 'util/formatting/url-format';
|
||||
import { PasswordPresenter } from 'util/formatting/password-presenter';
|
||||
import { Locale } from 'util/locale';
|
||||
import { Features } from 'util/features';
|
||||
import { FileSaver } from 'util/ui/file-saver';
|
||||
import { OpenConfigView } from 'views/open-config-view';
|
||||
import { omit } from 'util/fn';
|
||||
|
@ -68,7 +69,7 @@ class SettingsFileView extends View {
|
|||
});
|
||||
}
|
||||
|
||||
this.refreshYubiKeys();
|
||||
this.refreshYubiKeys(false);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -98,7 +99,7 @@ class SettingsFileView extends View {
|
|||
: '';
|
||||
const showYubiKeyBlock =
|
||||
!!this.model.chalResp ||
|
||||
(AppSettingsModel.enableUsb && AppSettingsModel.yubiKeyShowChalResp);
|
||||
(Launcher && AppSettingsModel.enableUsb && AppSettingsModel.yubiKeyShowChalResp);
|
||||
const yubiKeys = [];
|
||||
if (showYubiKeyBlock) {
|
||||
for (const yk of this.yubiKeys) {
|
||||
|
@ -733,22 +734,32 @@ class SettingsFileView extends View {
|
|||
}
|
||||
}
|
||||
|
||||
refreshYubiKeys() {
|
||||
if (!AppSettingsModel.enableUsb || !AppSettingsModel.yubiKeyShowChalResp) {
|
||||
refreshYubiKeys(userInitiated) {
|
||||
if (!Launcher || !AppSettingsModel.enableUsb || !AppSettingsModel.yubiKeyShowChalResp) {
|
||||
return;
|
||||
}
|
||||
if (!UsbListener.attachedYubiKeys) {
|
||||
if (!UsbListener.attachedYubiKeys.length) {
|
||||
if (this.yubiKeys.length) {
|
||||
this.yubiKeys = [];
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
YubiKey.list((err, yubiKeys) => {
|
||||
if (err) {
|
||||
if (err || this.removed) {
|
||||
return;
|
||||
}
|
||||
this.yubiKeys = yubiKeys;
|
||||
this.render();
|
||||
if (
|
||||
userInitiated &&
|
||||
UsbListener.attachedYubiKeys.length &&
|
||||
!yubiKeys.length &&
|
||||
Features.isMac
|
||||
) {
|
||||
Alerts.error({
|
||||
body: Locale.setFileYubiKeyErrorEmptyMac
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -757,7 +768,7 @@ class SettingsFileView extends View {
|
|||
const value = e.target.value;
|
||||
if (value === 'refresh') {
|
||||
this.render();
|
||||
this.refreshYubiKeys();
|
||||
this.refreshYubiKeys(true);
|
||||
return;
|
||||
}
|
||||
if (value) {
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
<div class="open-chal-resp">
|
||||
{{#if loading}}
|
||||
<div class="open-chal-resp__head">
|
||||
<i class="open-chal-resp__icon fa fa-spinner fa-spin"></i> {{res 'openChalRespLoading'}}
|
||||
<p>
|
||||
<i class="open-chal-resp__icon fa fa-spinner fa-spin"></i> {{res 'openChalRespLoading'}}
|
||||
</p>
|
||||
</div>
|
||||
{{else if error}}
|
||||
<div class="open-chal-resp__head">
|
||||
<i class="open-chal-resp__icon fa fa-ban"></i> {{error}}
|
||||
<p>
|
||||
<i class="open-chal-resp__icon fa fa-ban"></i> {{error}}
|
||||
</p>
|
||||
{{#if showEmptyMacWarning}}
|
||||
<p>{{res 'openChalRespErrorEmptyMac'}}</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="open-chal-resp__head">{{res 'openChalRespSelectYubiKey'}}:</div>
|
||||
<div class="open-chal-resp__head">
|
||||
<p>
|
||||
{{res 'openChalRespSelectYubiKey'}}:
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
{{#each yubiKeys as |yk|}}
|
||||
<div class="open-chal-resp__item"
|
||||
|
|
|
@ -82,24 +82,26 @@
|
|||
<a id="settings__file-file-select-link">{{res 'setFileSelKeyFile'}}</a>
|
||||
<input type="file" id="settings__file-file-select" class="hide-by-pos" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="settings__file-yubikey">{{res 'setFileYubiKey'}}:</label>
|
||||
<select class="settings__select settings__select-no-margin input-base" id="settings__file-yubikey">
|
||||
<option value="" {{#unless selectedYubiKey}}selected{{/unless}}>{{res 'setFileDontUseYubiKey'}}</option>
|
||||
{{#each yubiKeys as |yk|}}
|
||||
<option value="{{yk.value}}"
|
||||
{{#ifeq ../selectedYubiKey yk.value}}selected{{/ifeq}}
|
||||
data-vid="{{yk.vid}}"
|
||||
data-pid="{{yk.pid}}"
|
||||
data-serial="{{yk.serial}}"
|
||||
data-slot="{{yk.slot}}"
|
||||
>
|
||||
{{yk.fullName}}, {{res 'yubiKeySlot'}} {{yk.slot}}
|
||||
</option>
|
||||
{{/each}}
|
||||
<option value="refresh">{{res 'setFileRefreshYubiKeyList'}}</option>
|
||||
</select>
|
||||
</p>
|
||||
{{#if showYubiKeyBlock}}
|
||||
<p>
|
||||
<label for="settings__file-yubikey">{{res 'setFileYubiKey'}}:</label>
|
||||
<select class="settings__select settings__select-no-margin input-base" id="settings__file-yubikey">
|
||||
<option value="" {{#unless selectedYubiKey}}selected{{/unless}}>{{res 'setFileDontUseYubiKey'}}</option>
|
||||
{{#each yubiKeys as |yk|}}
|
||||
<option value="{{yk.value}}"
|
||||
{{#ifeq ../selectedYubiKey yk.value}}selected{{/ifeq}}
|
||||
data-vid="{{yk.vid}}"
|
||||
data-pid="{{yk.pid}}"
|
||||
data-serial="{{yk.serial}}"
|
||||
data-slot="{{yk.slot}}"
|
||||
>
|
||||
{{yk.fullName}}, {{res 'yubiKeySlot'}} {{yk.slot}}
|
||||
</option>
|
||||
{{/each}}
|
||||
<option value="refresh">{{res 'setFileRefreshYubiKeyList'}}</option>
|
||||
</select>
|
||||
</p>
|
||||
{{/if}}
|
||||
|
||||
<h2>{{res 'setFileNames'}}</h2>
|
||||
<label for="settings__file-name">{{Res 'name'}}:</label>
|
||||
|
|
Loading…
Reference in New Issue