From 32e7583f355e807d84eca5d26d87c083ebb6dfc7 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 21 Dec 2020 19:19:39 +0100 Subject: [PATCH] Add input mode support for `multifactor\totp\CodeFormField` --- com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl | 4 ++-- .../files/acp/templates/__multifactorTotpCodeField.tpl | 4 ++-- .../lib/system/user/multifactor/totp/CodeFormField.class.php | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl b/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl index baf29dacd4..d07dfc7a45 100644 --- a/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl +++ b/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl @@ -4,8 +4,8 @@ *}value="{if !$field->isI18n() || !$field->hasI18nValues() || $availableLanguages|count === 1}{$field->getValue()}{/if}" {* *}{if !$field->getFieldClasses()|empty}class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}" {/if}{* *}{if $field->getMaximumLength() !== null}size="{$field->getMaximumLength()}" {/if}{* - *}pattern="[0-9]*" {* - *}inputmode="numeric"{* + *}pattern="[0-9]*"{* + *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{* *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{* *}{if $field->isAutofocused()} autofocus{/if}{* *}{if $field->isRequired()} required{/if}{* diff --git a/wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl b/wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl index baf29dacd4..d07dfc7a45 100644 --- a/wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl +++ b/wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl @@ -4,8 +4,8 @@ *}value="{if !$field->isI18n() || !$field->hasI18nValues() || $availableLanguages|count === 1}{$field->getValue()}{/if}" {* *}{if !$field->getFieldClasses()|empty}class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}" {/if}{* *}{if $field->getMaximumLength() !== null}size="{$field->getMaximumLength()}" {/if}{* - *}pattern="[0-9]*" {* - *}inputmode="numeric"{* + *}pattern="[0-9]*"{* + *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{* *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{* *}{if $field->isAutofocused()} autofocus{/if}{* *}{if $field->isRequired()} required{/if}{* diff --git a/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php b/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php index 9496976c7c..d450c10a51 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php @@ -31,6 +31,7 @@ class CodeFormField extends TextFormField { $this->maximumLength(Totp::CODE_LENGTH); $this->addFieldClass('multifactorTotpCode'); $this->autoComplete('off'); + $this->inputMode('numeric'); $placeholder = ''; $gen = Helper::digitStream(); -- 2.20.1