Only gray out expired TOTP touch credentials.

This commit is contained in:
Dag Heyman 2017-03-08 13:58:42 +01:00
parent 9d7e9c37b7
commit 817d485334
No known key found for this signature in database
GPG Key ID: 06FC004369E7D338
2 changed files with 10 additions and 2 deletions

View File

@ -441,7 +441,7 @@ ApplicationWindow {
font.pointSize: 10
}
Text {
opacity: isInCoolDown(modelData.name) ? 0.6 : 1
opacity: isExpired(modelData) ? 0.6 : 1
visible: modelData.code != null
text: qsTr('') + modelData.code
font.family: "Verdana"
@ -486,7 +486,7 @@ ApplicationWindow {
onTriggered: {
var timeLeft = device.expiration - (Date.now() / 1000)
if (timeLeft <= 0 && progressBar.value > 0) {
device.refresh(refreshDependingOnMode)
refreshDependingOnMode(true)
totpCoolDowns = []
}
progressBar.value = timeLeft
@ -505,6 +505,11 @@ ApplicationWindow {
onTriggered: touchYourYubikey.open()
}
function isExpired(cred) {
return (cred.oath_type !== 'hotp')
&& (cred.expiration - (Date.now() / 1000) <= 0)
}
function refreshDependingOnMode(force) {
if (hasDevice && shouldRefresh) {
if (settings.slotMode && device.hasOTP) {

View File

@ -189,6 +189,9 @@ Python {
result.push(cred)
}
nextRefresh = minExpiration
// Credentials is cleared so that
// the view w refresh even if objects are the same
credentials = []
credentials = result
updateExpiration()
}