From a4f6b63ec2cb8fe93bcce23d09d9885b641de0ef Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 23 Dec 2020 16:16:03 +0100 Subject: [PATCH] Use `size` field attribute in `multifactor\backup\CodeFormField` --- .../templates/__multifactorBackupCodeField.tpl | 17 ----------------- .../templates/__multifactorBackupCodeField.tpl | 17 ----------------- .../multifactor/backup/CodeFormField.class.php | 6 +----- 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl delete mode 100644 wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl diff --git a/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl b/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl deleted file mode 100644 index 68f960a86c..0000000000 --- a/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl +++ /dev/null @@ -1,17 +0,0 @@ -getFieldClasses()|empty}class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}" {/if}{* - *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{* - *}{if $field->getChunks() && $field->getChunkLength()} size="{$field->getChunks() - 1 + $field->getChunks() * $field->getChunkLength()}"{/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/__multifactorBackupCodeField.tpl b/wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl deleted file mode 100644 index 68f960a86c..0000000000 --- a/wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl +++ /dev/null @@ -1,17 +0,0 @@ -getFieldClasses()|empty}class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}" {/if}{* - *}{if $field->getInputMode() !== null} inputmode="{$field->getInputMode()}"{/if}{* - *}{if $field->getChunks() && $field->getChunkLength()} size="{$field->getChunks() - 1 + $field->getChunks() * $field->getChunkLength()}"{/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/lib/system/user/multifactor/backup/CodeFormField.class.php b/wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php index e32b9b2ca0..54d67abaf2 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php @@ -27,15 +27,11 @@ class CodeFormField extends TextFormField { */ protected $chunkLength; - /** - * @inheritDoc - */ - protected $templateName = '__multifactorBackupCodeField'; - public function __construct() { $this->chunks(BackupMultifactorMethod::CHUNKS); $this->chunkLength(BackupMultifactorMethod::CHUNK_LENGTH); $this->minimumLength($this->getChunks() * $this->getChunkLength()); + $this->fieldAttribute('size', $this->getChunks() - 1 + $this->getChunks() * $this->getChunkLength()); $this->addFieldClass('multifactorBackupCode'); $this->autoComplete('off'); $this->inputMode('numeric'); -- 2.20.1