Fixed possible 2FA timing issue, #3249
Ylian Saint-Hilaire committed
Nov 5, 2021 at 18:04 UTC
18bdc7defa8e8c07d117e4ed76fcabab0124bb82
1 file changed
+2
-2
views/default.handlebars
+2
-2
@@ -2096,7 +2096,7 @@
2096
2097
// Return the number of 2nd factor for this account
2098
function count2factoraAuths() {
2099
- if (userinfo == null) return 0;
2099
+ if (userinfo == null) return -1;
2100
var authFactorCount = 0;
2101
if (userinfo.otpsecret == 1) { authFactorCount++; } // Authenticator time factor
2102
if (userinfo.otphkeys > 0) { authFactorCount += userinfo.otphkeys; } // FIDO hardware factor
@@ -2119,7 +2119,7 @@
2119
QV('authKeySetupCheck', userinfo.otphkeys > 0);
2120
QV('authPushAuthDevCheck', (userinfo.otpdev > 0) && ((features2 & 0x40) != 0));
2121
QV('authCodesSetupCheck', userinfo.otpkeys > 0);
2122
- QV('managePushAuthDev', (features2 & 0x40) && (count2factoraAuths() > 0));
2122
+ QV('managePushAuthDev', (features2 & 0x40) && (authFactorCount > 0));
2123
mainUpdate(4 + 128 + 4096);
2124
2125
// Check if none or at least 2 factors are enabled.