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

index d07dfc7a45dcc7c18ea9e6164ae5daed99fcd358..d2173c2b1727d9af9542aa6045285244e0eb05d9 100644 (file)
@@ -4,9 +4,9 @@
        *}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]*"{*
        *}{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}{*
index d07dfc7a45dcc7c18ea9e6164ae5daed99fcd358..d2173c2b1727d9af9542aa6045285244e0eb05d9 100644 (file)
@@ -4,9 +4,9 @@
        *}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]*"{*
        *}{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}{*
index 54fe658d447030dd929d64b58c9275aeed51f5af..4e560dc101bf80ba6422db617e00b87527758efa 100644 (file)
@@ -28,6 +28,7 @@ class CodeFormField extends TextFormField {
                $this->addFieldClass('multifactorEmailCode');
                $this->autoComplete('off');
                $this->inputMode('numeric');
+               $this->pattern('[0-9\s]*');
                
                $placeholder = '';
                $gen = Helper::digitStream();