mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2025-01-06 02:37:21 +03:00
Force refresh on settings closed
This commit is contained in:
parent
66693a842c
commit
b50b63a94c
36
qml/Main.qml
36
qml/Main.qml
@ -108,6 +108,7 @@ ApplicationWindow {
|
||||
settings.slot2 = settingsDialog.slot2
|
||||
settings.slot1digits = settingsDialog.slot1digits
|
||||
settings.slot2digits = settingsDialog.slot2digits
|
||||
refreshDependingOnMode(true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,23 +506,6 @@ ApplicationWindow {
|
||||
onTriggered: device.refresh(refreshDependingOnMode)
|
||||
}
|
||||
|
||||
function refreshDependingOnMode() {
|
||||
if (hasDevice) {
|
||||
if (settings.slotMode) {
|
||||
device.refreshSlotCredentials([settings.slot1, settings.slot2], getSlotDigitsSettings())
|
||||
} else {
|
||||
device.refreshCCIDCredentials()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSlotDigitsSettings() {
|
||||
var slot1digits = settings.slot1digits === 1 ? 8 : 6
|
||||
var slot2digits = settings.slot2digits === 1 ? 8 : 6
|
||||
return [slot1digits, slot2digits]
|
||||
}
|
||||
|
||||
|
||||
Timer {
|
||||
id: progressBarTimer
|
||||
interval: 100
|
||||
@ -531,7 +515,7 @@ ApplicationWindow {
|
||||
onTriggered: {
|
||||
var timeLeft = expiration - (Date.now() / 1000)
|
||||
if (timeLeft <= 0 && progressBar.value > 0) {
|
||||
device.refresh()
|
||||
device.refresh(refreshDependingOnMode)
|
||||
totpCoolDowns = []
|
||||
}
|
||||
progressBar.value = timeLeft
|
||||
@ -557,6 +541,22 @@ ApplicationWindow {
|
||||
|
||||
*******/
|
||||
|
||||
function refreshDependingOnMode(force) {
|
||||
if (hasDevice) {
|
||||
if (settings.slotMode) {
|
||||
device.refreshSlotCredentials([settings.slot1, settings.slot2], getSlotDigitsSettings(), force)
|
||||
} else {
|
||||
device.refreshCCIDCredentials(force)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSlotDigitsSettings() {
|
||||
var slot1digits = settings.slot1digits === 1 ? 8 : 6
|
||||
var slot2digits = settings.slot2digits === 1 ? 8 : 6
|
||||
return [slot1digits, slot2digits]
|
||||
}
|
||||
|
||||
function filteredCredentials(creds, search) {
|
||||
var result = []
|
||||
if (creds != null) {
|
||||
|
@ -84,16 +84,17 @@ Python {
|
||||
})
|
||||
}
|
||||
|
||||
function refreshCCIDCredentials() {
|
||||
function refreshCCIDCredentials(force) {
|
||||
var now = Math.floor(Date.now() / 1000)
|
||||
if (validated && nextRefresh < now) {
|
||||
refreshCredentials()
|
||||
if (force || (validated && nextRefresh < now)) {
|
||||
do_call('yubikey.controller.refresh_credentials', [now, passwordKey],
|
||||
handleCredentials)
|
||||
}
|
||||
}
|
||||
|
||||
function refreshSlotCredentials(slots, digits) {
|
||||
function refreshSlotCredentials(slots, digits, force) {
|
||||
var now = Math.floor(Date.now() / 1000)
|
||||
if (nextRefresh < now) {
|
||||
if (force || (nextRefresh < now)) {
|
||||
do_call('yubikey.controller.refresh_slot_credentials', [slots, digits, now], handleCredentials)
|
||||
}
|
||||
}
|
||||
@ -130,13 +131,6 @@ Python {
|
||||
})
|
||||
}
|
||||
|
||||
function refreshCredentials() {
|
||||
var now = Math.floor(Date.now() / 1000)
|
||||
do_call('yubikey.controller.refresh_credentials', [now, passwordKey],
|
||||
handleCredentials)
|
||||
}
|
||||
|
||||
|
||||
function handleCredentials(creds) {
|
||||
var result = []
|
||||
var minExpiration = (Date.now() / 1000) + 10000
|
||||
|
Loading…
Reference in New Issue
Block a user