fixed the yubikey challenge-response icon on the open screen

This commit is contained in:
antelle 2020-05-23 19:26:54 +02:00
parent 1f862a37e9
commit efa9b5f9a7
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
3 changed files with 16 additions and 10 deletions

View File

@ -111,6 +111,7 @@ class OpenView extends View {
this.model.settings.canOpenOtpDevice &&
this.model.settings.yubiKeyShowIcon &&
!this.model.files.get('yubikey');
const canUseChalRespYubiKey = hasYubiKeys && this.model.settings.yubiKeyShowChalResp;
super.render({
lastOpenFiles: this.getLastOpenFiles(),
@ -124,7 +125,7 @@ class OpenView extends View {
canCreate: this.model.settings.canCreate,
canRemoveLatest: this.model.settings.canRemoveLatest,
canOpenYubiKey,
hasYubiKeys,
canUseChalRespYubiKey,
showMore,
showLogo
});
@ -990,13 +991,17 @@ class OpenView extends View {
}
usbDevicesChanged() {
if (this.model.settings.canOpenOtpDevice && this.model.settings.yubiKeyShowIcon) {
if (this.model.settings.canOpenOtpDevice) {
const hasYubiKeys = !!UsbListener.attachedYubiKeys.length;
this.$el.find('.open__icon-yubikey').toggleClass('hide', !hasYubiKeys);
const showOpenIcon = hasYubiKeys && this.model.settings.yubiKeyShowIcon;
this.$el.find('.open__icon-yubikey').toggleClass('hide', !showOpenIcon);
const showChallengeResponseIcon =
hasYubiKeys && this.model.settings.yubiKeyShowChalResp;
this.$el
.find('.open__settings-yubikey')
.toggleClass('open__settings-yubikey--present', hasYubiKeys);
.toggleClass('open__settings-yubikey--present', !!showChallengeResponseIcon);
if (!hasYubiKeys && this.busy && this.otpDevice) {
this.otpDevice.cancelOpen();

View File

@ -90,7 +90,8 @@
</i><span class="open__settings-key-file-name">{{res 'openKeyFile'}}</span>
{{#if canOpenKeyFromDropbox}}<span class="open__settings-key-file-dropbox"> {{res 'openKeyFileDropbox'}}</span>{{/if}}
</div>
<div class="open__settings-yubikey {{#if hasYubiKeys}}open__settings-yubikey--present{{/if}} hide" tabindex="26" title="YubiKey">
<div class="open__settings-yubikey {{#if canUseChalRespYubiKey}}open__settings-yubikey--present{{/if}} hide"
tabindex="26" title="YubiKey">
{{{svg 'usb-token' 'open__settings-yubikey-img'}}}
</div>
</div>

View File

@ -26,16 +26,16 @@
{{#if yubiKeyShowIcon}}checked{{/if}} />
<label for="settings__yubikey-show-icon">{{res 'setDevicesYubiKeyOtpShowIcon'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__yubikey-auto-open" id="settings__yubikey-auto-open"
{{#if yubiKeyAutoOpen}}checked{{/if}} />
<label for="settings__yubikey-auto-open">{{res 'setDevicesYubiKeyOtpAutoOpen'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__yubikey-match-entries" id="settings__yubikey-match-entries"
{{#if yubiKeyMatchEntries}}checked{{/if}} />
<label for="settings__yubikey-match-entries">{{res 'setDevicesYubiKeyOtpMatchEntries'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__yubikey-auto-open" id="settings__yubikey-auto-open"
{{#if yubiKeyAutoOpen}}checked{{/if}} />
<label for="settings__yubikey-auto-open">{{res 'setDevicesYubiKeyOtpAutoOpen'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__yubikey-oath-workaround" id="settings__yubikey-oath-workaround"
{{#if yubiKeyOathWorkaround}}checked{{/if}} />