diff --git a/src/Application/Controller/Admin/d3totpadminlogin.php b/src/Application/Controller/Admin/d3totpadminlogin.php index 0550a8f..d62bde7 100644 --- a/src/Application/Controller/Admin/d3totpadminlogin.php +++ b/src/Application/Controller/Admin/d3totpadminlogin.php @@ -147,7 +147,7 @@ class d3totpadminlogin extends AdminController $userId = $user->d3TotpGetCurrentUser(); try { - $sTotp = Registry::getRequest()->getRequestEscapedParameter('d3totp'); + $sTotp = implode('', Registry::getRequest()->getRequestEscapedParameter('d3totp')); $totp = $this->d3TotpGetTotpObject(); $totp->loadByUserId($userId); diff --git a/src/Application/views/admin/tpl/d3totplogin.tpl b/src/Application/views/admin/tpl/d3totplogin.tpl index e0233cc..0def3f9 100644 --- a/src/Application/views/admin/tpl/d3totplogin.tpl +++ b/src/Application/views/admin/tpl/d3totplogin.tpl @@ -22,16 +22,49 @@ +

[{oxmultilang ident="TOTP_INPUT"}]

+ [{if !empty($Errors.default)}] [{include file="inc_error.tpl" Errorlist=$Errors.default}] [{/if}] [{$oView->getBackupCodeCountMessage()}] - -
+
+ + + + + + + + + + + + +
- [{oxmultilang ident="TOTP_INPUT_HELP"}] + [{capture name="d3js"}] + function clickEvent(next){ + const digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + if(digits.includes(event.key)){ + document.getElementById(next).focus(); + } + } + document.addEventListener("paste", function(e) { + if (e.target.type === "text") { + var data = e.clipboardData.getData('Text'); + data = data.split(''); + [].forEach.call(document.querySelectorAll("#login input[type=text]"), (node, index) => { + node.value = data[index]; + }); + } + }); + [{/capture}] + [{oxscript add=$smarty.capture.d3js}] + +
[{oxmultilang ident="TOTP_INPUT_HELP"}]

diff --git a/src/Application/views/tpl/d3totplogin.tpl b/src/Application/views/tpl/d3totplogin.tpl index d230730..4a6d77f 100644 --- a/src/Application/views/tpl/d3totplogin.tpl +++ b/src/Application/views/tpl/d3totplogin.tpl @@ -15,16 +15,49 @@ [{$navFormParams}] +

[{oxmultilang ident="D3_TOTP_INPUT"}]

+ [{if !empty($Errors.default)}] [{include file="inc_error.tpl" Errorlist=$Errors.default}] [{/if}] [{$oView->getBackupCodeCountMessage()}] - -
+
+ + + + + + + + + + + + +
- [{oxmultilang ident="D3_TOTP_INPUT_HELP"}] + [{capture name="d3js"}] + function clickEvent(next){ + const digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; + if(digits.includes(event.key)){ + document.getElementById(next).focus(); + } + } + document.addEventListener("paste", function(e) { + if (e.target.type === "text") { + var data = e.clipboardData.getData('Text'); + data = data.split(''); + [].forEach.call(document.querySelectorAll("#login input[type=text]"), (node, index) => { + node.value = data[index]; + }); + } + }); + [{/capture}] + [{oxscript add=$smarty.capture.d3js}] + +
[{oxmultilang ident="D3_TOTP_INPUT_HELP"}]