Add pattern support for `multifactor\backup\CodeFormField`
authorMatthias Schmidt <gravatronics@live.com>
Tue, 22 Dec 2020 13:05:24 +0000 (14:05 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 22 Dec 2020 13:05:24 +0000 (14:05 +0100)
com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl
wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl
wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php

index 5623d65ed21bc79d5ebfca8088bd9ee4d2c273b4..68f960a86cb37f6d049a69d9dbda1b76ef6d76a5 100644 (file)
@@ -3,10 +3,10 @@
        *}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}{*
-       *}pattern="[0-9\s]*"{*
        *}{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}{*
index 5623d65ed21bc79d5ebfca8088bd9ee4d2c273b4..68f960a86cb37f6d049a69d9dbda1b76ef6d76a5 100644 (file)
@@ -3,10 +3,10 @@
        *}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}{*
-       *}pattern="[0-9\s]*"{*
        *}{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}{*
index ed88fa3be54d02df28e0ca965f4e7c1bfdf473a8..e32b9b2ca0867333377d6bd1a39f0e87d043d52e 100644 (file)
@@ -39,6 +39,7 @@ class CodeFormField extends TextFormField {
                $this->addFieldClass('multifactorBackupCode');
                $this->autoComplete('off');
                $this->inputMode('numeric');
+               $this->pattern('[0-9\s]*');
                
                $placeholder = '';
                $gen = Helper::digitStream();