Add pattern support for `multifactor\totp\CodeFormField`
authorMatthias Schmidt <gravatronics@live.com>
Tue, 22 Dec 2020 13:05:47 +0000 (14:05 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 22 Dec 2020 13:05:47 +0000 (14:05 +0100)
com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl
wcfsetup/install/files/acp/templates/__multifactorTotpCodeField.tpl
wcfsetup/install/files/lib/system/user/multifactor/totp/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 d450c10a51f7678c1714de934d554f80d6586d5e..f69f68bc4d3f00888c939a64e720945214024a33 100644 (file)
@@ -32,6 +32,7 @@ class CodeFormField extends TextFormField {
                $this->addFieldClass('multifactorTotpCode');
                $this->autoComplete('off');
                $this->inputMode('numeric');
+               $this->pattern('[0-9\s]*');
                
                $placeholder = '';
                $gen = Helper::digitStream();