Fixed possible 2FA timing issue, #3249

This commit is contained in:
Ylian Saint-Hilaire 2021-11-05 18:04:33 -07:00
parent 14283aef12
commit 18bdc7defa

View File

@ -2096,7 +2096,7 @@
// Return the number of 2nd factor for this account
function count2factoraAuths() {
if (userinfo == null) return 0;
if (userinfo == null) return -1;
var authFactorCount = 0;
if (userinfo.otpsecret == 1) { authFactorCount++; } // Authenticator time factor
if (userinfo.otphkeys > 0) { authFactorCount += userinfo.otphkeys; } // FIDO hardware factor
@ -2119,7 +2119,7 @@
QV('authKeySetupCheck', userinfo.otphkeys > 0);
QV('authPushAuthDevCheck', (userinfo.otpdev > 0) && ((features2 & 0x40) != 0));
QV('authCodesSetupCheck', userinfo.otpkeys > 0);
QV('managePushAuthDev', (features2 & 0x40) && (count2factoraAuths() > 0));
QV('managePushAuthDev', (features2 & 0x40) && (authFactorCount > 0));
mainUpdate(4 + 128 + 4096);
// Check if none or at least 2 factors are enabled.