Use `size` field attribute in `multifactor\multifactor\CodeFormField`
authorMatthias Schmidt <gravatronics@live.com>
Wed, 23 Dec 2020 15:16:24 +0000 (16:16 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 23 Dec 2020 15:16:24 +0000 (16:16 +0100)
com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl [deleted file]
wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl [deleted file]
wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php

diff --git a/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl b/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl
deleted file mode 100644 (file)
index d2173c2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<input type="text" {*
-       *}id="{@$field->getPrefixedId()}" {*
-       *}name="{@$field->getPrefixedId()}" {*
-       *}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}{*
-       *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{*
-       *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{*
-       *}{if $field->getPattern() !== null} pattern="{$field->getPattern()}"{/if}{*
-       *}{if $field->isAutofocused()} autofocus{/if}{*
-       *}{if $field->isRequired()} required{/if}{*
-       *}{if $field->isImmutable()} disabled{/if}{*
-       *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{*
-       *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{*
-       *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{*
-       *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{*
-*}>
diff --git a/wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl b/wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl
deleted file mode 100644 (file)
index d2173c2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<input type="text" {*
-       *}id="{@$field->getPrefixedId()}" {*
-       *}name="{@$field->getPrefixedId()}" {*
-       *}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}{*
-       *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{*
-       *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{*
-       *}{if $field->getPattern() !== null} pattern="{$field->getPattern()}"{/if}{*
-       *}{if $field->isAutofocused()} autofocus{/if}{*
-       *}{if $field->isRequired()} required{/if}{*
-       *}{if $field->isImmutable()} disabled{/if}{*
-       *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{*
-       *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{*
-       *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{*
-       *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{*
-*}>
index 0ff43ea93e6c931365c0e1c3d08cdc9e4d84a461..153d564741d953e35e556aaa5efc77314d9a25dc 100644 (file)
@@ -16,11 +16,6 @@ use wcf\system\user\multifactor\Helper;
 class CodeFormField extends TextFormField {
        use TDefaultIdFormField;
        
-       /**
-        * @inheritDoc
-        */
-       protected $templateName = '__multifactorTotpCodeField';
-       
        /**
         * @var ?int
         */
@@ -29,6 +24,7 @@ class CodeFormField extends TextFormField {
        public function __construct() {
                $this->minimumLength(Totp::CODE_LENGTH);
                $this->maximumLength(Totp::CODE_LENGTH);
+               $this->fieldAttribute('size', Totp::CODE_LENGTH);
                $this->addFieldClass('multifactorTotpCode');
                $this->autoComplete('off');
                $this->inputMode('numeric');