From 315f5058336e822acd528c3095c9b841932c3c6c Mon Sep 17 00:00:00 2001 From: ansuz Date: Sat, 22 Jul 2023 11:47:29 +0530 Subject: [PATCH 1/2] set cursor in OTP input field --- www/common/common-interface.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index ac8a53409..cd3d1b406 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -1539,6 +1539,8 @@ define([ $btn.click(); }); UI.errorLoadingScreen(block, false, exitable); + // set the user's cursor in the OTP input field + $(block).find('.cp-password-form input').focus(); }; From 601a15e848e0f9c7e663720a2dccb8c6ffc68e49 Mon Sep 17 00:00:00 2001 From: ansuz Date: Sat, 22 Jul 2023 13:45:06 +0530 Subject: [PATCH 2/2] 2FA setup usability improvements: * focus OTP fields when prompting the user * 'submit' account password and OTPs on enter keyup --- www/settings/inner.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/www/settings/inner.js b/www/settings/inner.js index ec8b55142..9ccd08e85 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -938,6 +938,11 @@ define([ ]); $content.append(pwContainer); + // submit password on enter keyup + $(pwInput).on('keyup', e => { + if (e.which === 13) { $mfaRevokeBtn.click(); } + }); + var spinner = UI.makeSpinner($mfaRevokeBtn); $mfaRevokeBtn.click(function () { var name = privateData.accountName; @@ -1004,6 +1009,11 @@ define([ }, {raw: true}); }); + OTPEntry.focus(); + // submit OTP on enter keyup + $OTPEntry.on('keyup', e => { + if (e.which === 13) { $d.click(); } + }); }); }); @@ -1023,6 +1033,12 @@ define([ button ])); var spinner = UI.makeSpinner($mfaSetupBtn); + + // submit password on enter keyup + $(pwInput).on('keyup', e => { + if (e.which === 13) { $(button).click(); } + }); + $(button).click(function () { var name = privateData.accountName; var password = $(pwInput).val(); @@ -1175,6 +1191,11 @@ define([ ]) ]) ]); + OTPEntry.focus(); + // submit OTP on enter keyup + $OTPEntry.on('keyup', e => { + if (e.which === 13) { $(confirmOTP).click(); } + }); };