Skip to content

Commit

Permalink
[4.4] Improve Totp code input (#42608)
Browse files Browse the repository at this point in the history
* [4.4] Improve Totp code input

* Fix code input pattern attribute

* Specify autocomplete on code input

* [4.4] Improve Totp code input

* Fix typo

* [4.4] Improve Totp code input

* Fix mixed single/double quotes

* Add code input required attribute to disable submitting an empty code value

* [4.4] Improve Totp code input

* Apply same fix to Email Totp:
  - Fix code input pattern attribute
  - Specify autocomplete on code input
  - Add code input required attribute to disable submitting an empty code value
  - Fix mixed single/double quotes

---------
  • Loading branch information
sitecode authored Jan 19, 2024
1 parent deae2f0 commit 302ce23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/multifactorauth/email/src/Extension/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function onUserMultifactorCaptive(Captive $event): void
'input_type' => 'text',
// The attributes for the HTML input box.
'input_attributes' => [
'pattern' => "{0,9}", 'maxlength' => "6", 'inputmode' => "numeric",
'pattern' => '[0-9]{6}', 'maxlength' => '6', 'inputmode' => 'numeric', 'required' => 'true', 'autocomplete' => 'one-time-code', 'aria-autocomplete' => 'none',
],
// Placeholder text for the HTML input box. Leave empty if you don't need it.
'placeholder' => Text::_('PLG_MULTIFACTORAUTH_EMAIL_LBL_SETUP_PLACEHOLDER'),
Expand Down Expand Up @@ -264,7 +264,7 @@ public function onUserMultifactorGetSetup(GetSetup $event): void
'field_type' => 'input',
'input_type' => 'text',
'input_attributes' => [
'pattern' => "{0,9}", 'maxlength' => "6", 'inputmode' => "numeric",
'pattern' => '[0-9]{6}', 'maxlength' => '6', 'inputmode' => 'numeric', 'required' => 'true', 'autocomplete' => 'one-time-code', 'aria-autocomplete' => 'none',
],
'input_value' => '',
'placeholder' => Text::_('PLG_MULTIFACTORAUTH_EMAIL_LBL_SETUP_PLACEHOLDER'),
Expand Down
4 changes: 2 additions & 2 deletions plugins/multifactorauth/totp/src/Extension/Totp.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function onUserMultifactorCaptive(Captive $event): void
'input_type' => 'text',
// The attributes for the HTML input box.
'input_attributes' => [
'pattern' => "{0,9}", 'maxlength' => "6", 'inputmode' => "numeric",
'pattern' => '[0-9]{6}', 'maxlength' => '6', 'inputmode' => 'numeric', 'required' => 'true', 'autocomplete' => 'one-time-code', 'aria-autocomplete' => 'none',
],
// Placeholder text for the HTML input box. Leave empty if you don't need it.
'placeholder' => '',
Expand Down Expand Up @@ -239,7 +239,7 @@ public function onUserMultifactorGetSetup(GetSetup $event): void
],
'input_type' => $isConfigured ? 'hidden' : 'text',
'input_attributes' => [
'pattern' => "{0,9}", 'maxlength' => "6", 'inputmode' => "numeric",
'pattern' => '[0-9]{6}', 'maxlength' => '6', 'inputmode' => 'numeric', 'required' => 'true', 'autocomplete' => 'one-time-code', 'aria-autocomplete' => 'none',
],
'input_value' => '',
'placeholder' => Text::_('PLG_MULTIFACTORAUTH_TOTP_LBL_SETUP_PLACEHOLDER'),
Expand Down

0 comments on commit 302ce23

Please sign in to comment.