Fix Always On TOTP update when a HOTP exists - Closes #265

This commit is contained in:
Bubka 2023-12-29 17:53:51 +01:00
parent 78a1eebdd2
commit 9fa4142a12

View File

@ -253,14 +253,16 @@
fetchPromise.then(response => {
let generatedAt = 0
// twofaccounts OTP updates
// twofaccounts TOTP updates
response.data.forEach((account) => {
const index = twofaccounts.items.findIndex(acc => acc.id === account.id)
if (twofaccounts.items[index] == undefined) {
twofaccounts.items.push(account)
if (account.otp_type === 'totp') {
const index = twofaccounts.items.findIndex(acc => acc.id === account.id)
if (twofaccounts.items[index] == undefined) {
twofaccounts.items.push(account)
}
else twofaccounts.items[index].otp = account.otp
generatedAt = account.otp.generated_at
}
else twofaccounts.items[index].otp = account.otp
generatedAt = account.otp.generated_at
})
// Loopers restart at new timestamp