Telegram 2FA fixes (#4650)

Ylian Saint-Hilaire committed Oct 23, 2022 at 08:49 UTC 90e271df972e71e7e13ca319f34b22618aecd307
3 files changed +11 -11
views/default.handlebars
+1 -1
@@ -424,8 +424,8 @@
424 <div id="manageAuthApp"><div class="p2AccountActions"><span id="authAppSetupCheck"><strong>&#x2713;</strong></span></div><span><a href=# onclick="return account_manageAuthApp()">Manage authenticator app</a><br /></span></div>
425 <div id="manageHardwareOtp"><div class="p2AccountActions"><span id="authKeySetupCheck"><strong>&#x2713;</strong></span></div><span><a href=# onclick="return account_manageHardwareOtp(0)">Manage security keys</a><br /></span></div>
426 <div id="managePushAuthDev"><div class="p2AccountActions"><span id="authPushAuthDevCheck"><strong>&#x2713;</strong></span></div><span><a href=# onclick="return account_managePushAuthDev()">Manage push authentication</a><br /></span></div>
427 - <div id="manageOtp"><div class="p2AccountActions"><span id="authCodesSetupCheck"><strong>&#x2713;</strong></span></div><span><a href=# onclick="return account_manageOtp(0)">Manage backup codes</a><br /></span></div>
427 <div id="manageMessaging1"><div class="p2AccountActions"><span id="authMessagingCheck"><strong>&#x2713;</strong></span></div><span><a href=# onclick="return account_manageMessaging()">Manage messaging</a><br /></span></div>
428 + <div id="manageOtp"><div class="p2AccountActions"><span id="authCodesSetupCheck"><strong>&#x2713;</strong></span></div><span><a href=# onclick="return account_manageOtp(0)">Manage backup codes</a><br /></span></div>
429 <div class="p2AccountActions"></div><span><a href=# onclick="return account_viewPreviousLogins()">View previous logins</a><br /></span>
430 </div>
431 </div>
views/login.handlebars
+6 -6
@@ -456,9 +456,9 @@
456 try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
457 var twofakey = (hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn');
458 QV('securityKeyButton', twofakey);
459 - QV('emailKeyButton', otpemail && (messageid != 2) && (messageid != 4));
460 - QV('smsKeyButton', otpsms && (messageid != 2) && (messageid != 4));
461 - QV('msgKeyButton', otpmsg && (messageid != 2) && (messageid != 4));
459 + QV('emailKeyButton', otpemail && (messageid != 2) && (messageid != 4) && (messageid != 6));
460 + QV('smsKeyButton', otpsms && (messageid != 2) && (messageid != 4) && (messageid != 6));
461 + QV('msgKeyButton', otpmsg && (messageid != 2) && (messageid != 4) && (messageid != 6));
462
463 // If hardware key is an option, trigger it now
464 if (autofido && twofakey) { setTimeout(function () { useSecurityKey(1); }, 300); }
@@ -469,9 +469,9 @@
469 try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
470 var twofakey = (hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn');
471 QV('securityKeyButton2', twofakey);
472 - QV('emailKeyButton2', otpemail && (messageid != 2) && (messageid != 4));
473 - QV('smsKeyButton2', otpsms && (messageid != 2) && (messageid != 4));
474 - QV('msgKeyButton2', otpmsg && (messageid != 2) && (messageid != 4));
472 + QV('emailKeyButton2', otpemail && (messageid != 2) && (messageid != 4) && (messageid != 6));
473 + QV('smsKeyButton2', otpsms && (messageid != 2) && (messageid != 4) && (messageid != 6));
474 + QV('msgKeyButton2', otpmsg && (messageid != 2) && (messageid != 4) && (messageid != 6));
475
476 // If hardware key is an option, trigger it now
477 if (autofido && twofakey) { setTimeout(function () { useSecurityKey(2); }, 300); }
views/login2.handlebars
+4 -4
@@ -528,10 +528,10 @@
528 if (tokenTimeout > 0) { setTimeout(function () { Q('hwtokenInput').value = '**timeout**'; QE('tokenOkButton', true); Q('tokenOkButton').click(); }, tokenTimeout); }
529 try { if (hardwareKeyChallenge.length > 0) { hardwareKeyChallenge = JSON.parse(hardwareKeyChallenge); } else { hardwareKeyChallenge = null; } } catch (ex) { hardwareKeyChallenge = null }
530 var twofakey = (hardwareKeyChallenge != null) && (hardwareKeyChallenge.type == 'webAuthn');
531 - var emailkey = otpemail && (messageid != 2) && (messageid != 4);
532 - var smskey = otpsms && (messageid != 2) && (messageid != 4);
533 - var msgkey = otpmsg && (messageid != 2) && (messageid != 4);
534 - var pushkey = otppush && (messageid != 2) && (messageid != 4);
531 + var emailkey = otpemail && (messageid != 2) && (messageid != 4) && (messageid != 6);
532 + var smskey = otpsms && (messageid != 2) && (messageid != 4) && (messageid != 6);
533 + var msgkey = otpmsg && (messageid != 2) && (messageid != 4) && (messageid != 6);
534 + var pushkey = otppush && (messageid != 2) && (messageid != 4) && (messageid != 6);
535 QV('securityKeyButton2', twofakey);
536 QV('emailKeyButton2', emailkey);
537 QV('smsKeyButton2', smskey);