Fixed exception when userinfo not received.

Ylian Saint-Hilaire committed Dec 28, 2020 at 14:45 UTC 28d86279dcff6b3d29ea9822fbb6fe249bd2b995
1 file changed +4 -2
views/default.handlebars
+4 -2
@@ -1936,10 +1936,12 @@
1936 // Return the number of 2nd factor for this account
1937 function count2factoraAuths() {
1938 var authFactorCount = 0;
1939 - if (userinfo.otpsecret == 1) { authFactorCount++; } // Authenticator time factor
1939 + if (userinfo != null) {
1940 + if (userinfo.otpsecret == 1) { authFactorCount++; } // Authenticator time factor
1941 + if (userinfo.otphkeys != null) { authFactorCount += userinfo.otphkeys; } // FIDO hardware factor
1942 + }
1943 if ((features & 0x00800000) && (userinfo.otpekey == 1)) { authFactorCount++; } // EMail factor
1944 if ((features & 0x04000000) && (userinfo.phone != null)) { authFactorCount++; } // SMS factor
1942 - if (userinfo.otphkeys != null) { authFactorCount += userinfo.otphkeys; } // FIDO hardware factor
1945 if ((authFactorCount > 0) && (userinfo.otpkeys == 1)) { authFactorCount++; } // Backup keys
1946 return authFactorCount;
1947 }