mirror of https://github.com/keeweb/keeweb.git
added an error when usb is disabled
This commit is contained in:
parent
eab683ec71
commit
c1d354a6fb
|
@ -6,6 +6,7 @@ import { Alerts } from 'comp/ui/alerts';
|
||||||
import { Locale } from 'util/locale';
|
import { Locale } from 'util/locale';
|
||||||
import { Timeouts } from 'const/timeouts';
|
import { Timeouts } from 'const/timeouts';
|
||||||
import { Launcher } from 'comp/launcher';
|
import { Launcher } from 'comp/launcher';
|
||||||
|
import { AppSettingsModel } from 'models/app-settings-model';
|
||||||
|
|
||||||
const logger = new Logger('chal-resp');
|
const logger = new Logger('chal-resp');
|
||||||
|
|
||||||
|
@ -32,6 +33,21 @@ const ChalRespCalculator = {
|
||||||
return resolve(Buffer.from(respFromCache, 'hex'));
|
return resolve(Buffer.from(respFromCache, 'hex'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!AppSettingsModel.enableUsb) {
|
||||||
|
logger.debug('USB is disabled');
|
||||||
|
Alerts.error({
|
||||||
|
header: Locale.yubiKeyDisabledErrorHeader,
|
||||||
|
body: Locale.yubiKeyDisabledErrorBody,
|
||||||
|
complete() {
|
||||||
|
const err = new Error(Locale.yubiKeyDisabledErrorHeader);
|
||||||
|
err.userCanceled = true;
|
||||||
|
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
logger.debug('Calculating ChalResp using a YubiKey', params);
|
logger.debug('Calculating ChalResp using a YubiKey', params);
|
||||||
|
|
||||||
this._calc(params, challenge, (err, response) => {
|
this._calc(params, challenge, (err, response) => {
|
||||||
|
@ -105,7 +121,7 @@ const ChalRespCalculator = {
|
||||||
let deviceEnumerationTimer;
|
let deviceEnumerationTimer;
|
||||||
|
|
||||||
const onUsbDevicesChanged = () => {
|
const onUsbDevicesChanged = () => {
|
||||||
if (UsbListener.attachedYubiKeys.length === 0) {
|
if (!UsbListener.attachedYubiKeys) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
deviceEnumerationTimer = setTimeout(() => {
|
deviceEnumerationTimer = setTimeout(() => {
|
||||||
|
|
|
@ -684,5 +684,7 @@
|
||||||
"yubiKeyNoKeyBody": "Please insert your YubiKey with serial number {}",
|
"yubiKeyNoKeyBody": "Please insert your YubiKey with serial number {}",
|
||||||
"yubiKeySlot": "slot",
|
"yubiKeySlot": "slot",
|
||||||
"yubiKeyTouchRequestedHeader": "Touch your YubiKey",
|
"yubiKeyTouchRequestedHeader": "Touch your YubiKey",
|
||||||
"yubiKeyTouchRequestedBody": "Please touch your YubiKey with serial number {}"
|
"yubiKeyTouchRequestedBody": "Please touch your YubiKey with serial number {}",
|
||||||
|
"yubiKeyDisabledErrorHeader": "USB is disabled",
|
||||||
|
"yubiKeyDisabledErrorBody": "YubiKey is required to open this file, please enable USB devices in settings."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue