nfc: improve error handling

This commit is contained in:
Dag Heyman 2020-06-09 13:00:54 +02:00
parent 0e134bffcc
commit cab3c009c5
4 changed files with 21 additions and 2 deletions

View File

@ -112,11 +112,12 @@ Pane {
} else {
navigator.snackBar(qsTr("Re-tap your YubiKey"))
}
} else if (resp.error_id === 'no_device_custom_reader') {
yubiKey.clearCurrentDeviceAndEntries()
} else {
navigator.snackBarError(navigator.getErrorMessage(
resp.error_id))
if (resp.error_id === 'no_device_custom_reader') {
yubiKey.clearCurrentDeviceAndEntries()
}
}
console.log("calculate failed:", resp.error_id)
}
@ -157,7 +158,11 @@ Pane {
navigator.snackBarError(
navigator.getErrorMessage(resp.error_id))
console.log("delete failed:", resp.error_id)
if (resp.error_id === 'no_device_custom_reader') {
yubiKey.clearCurrentDeviceAndEntries()
}
}
})
}

View File

@ -49,6 +49,9 @@ StyledExpansionPanel {
} else {
navigator.snackBarError(getErrorMessage(resp.error_id))
console.log("change password failed:", resp.error_id)
if (resp.error_id === 'no_device_custom_reader') {
yubiKey.clearCurrentDeviceAndEntries()
}
}
clearPasswordFields()
navigator.goToSettings()
@ -65,6 +68,9 @@ StyledExpansionPanel {
} else {
navigator.snackBarError(getErrorMessage(resp.error_id))
console.log("set password failed:", resp.error_id)
if (resp.error_id === 'no_device_custom_reader') {
yubiKey.clearCurrentDeviceAndEntries()
}
}
clearPasswordFields()
navigator.goToSettings()
@ -83,6 +89,9 @@ StyledExpansionPanel {
} else {
navigator.snackBarError(getErrorMessage(resp.error_id))
console.log("remove password failed:", resp.error_id)
if (resp.error_id === 'no_device_custom_reader') {
yubiKey.clearCurrentDeviceAndEntries()
}
}
clearPasswordFields()
navigator.goToSettings()

View File

@ -33,7 +33,11 @@ StyledExpansionPanel {
resp.error_id))
console.log("reset failed:",
resp.error_id)
if (resp.error_id === 'no_device_custom_reader') {
yubiKey.clearCurrentDeviceAndEntries()
}
}
navigator.goToSettings()
})
}

View File

@ -333,6 +333,7 @@ Python {
currentDeviceValidated = false
navigator.goToEnterPasswordIfNotInSettings()
} else if (resp.error_id === 'no_device_custom_reader') {
navigator.snackBarError(navigator.getErrorMessage(resp.error_id))
clearCurrentDeviceAndEntries()
} else {
clearCurrentDeviceAndEntries()