From 1dc1e260d4c91e4d888dccd3dd09358bbc188e25 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sat, 19 Dec 2020 13:16:33 +0100 Subject: [PATCH] Add autocomplete support for username form field --- com.woltlab.wcf/templates/__usernameFormField.tpl | 1 + .../files/acp/templates/__usernameFormField.tpl | 1 + .../builder/field/user/UsernameFormField.class.php | 13 ++++++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/com.woltlab.wcf/templates/__usernameFormField.tpl b/com.woltlab.wcf/templates/__usernameFormField.tpl index 4df1dfda16..63dc44d048 100644 --- a/com.woltlab.wcf/templates/__usernameFormField.tpl +++ b/com.woltlab.wcf/templates/__usernameFormField.tpl @@ -3,6 +3,7 @@ *}name="{@$field->getPrefixedId()}" {* *}value="{$field->getValue()}" {* *}class="long"{* + *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{* *}{if $field->isAutofocused()} autofocus{/if}{* *}{if $field->isRequired()} required{/if}{* *}{if $field->isImmutable()} disabled{/if}{* diff --git a/wcfsetup/install/files/acp/templates/__usernameFormField.tpl b/wcfsetup/install/files/acp/templates/__usernameFormField.tpl index 4df1dfda16..63dc44d048 100644 --- a/wcfsetup/install/files/acp/templates/__usernameFormField.tpl +++ b/wcfsetup/install/files/acp/templates/__usernameFormField.tpl @@ -3,6 +3,7 @@ *}name="{@$field->getPrefixedId()}" {* *}value="{$field->getValue()}" {* *}class="long"{* + *}{if $field->getAutoComplete() !== null} autocomplete="{$field->getAutoComplete()}"{/if}{* *}{if $field->isAutofocused()} autofocus{/if}{* *}{if $field->isRequired()} required{/if}{* *}{if $field->isImmutable()} disabled{/if}{* diff --git a/wcfsetup/install/files/lib/system/form/builder/field/user/UsernameFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/user/UsernameFormField.class.php index 90e73faa8b..b13a86d8d4 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/user/UsernameFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/user/UsernameFormField.class.php @@ -1,12 +1,14 @@ minimumLength(3); } + /** + * @inheritDoc + * @since 5.4 + */ + protected function getValidAutoCompleteTokens(): array { + return ['username']; + } + /** * @inheritDoc */ -- 2.20.1