From 1f02a598d421f0451d08d4f90161f7cc9c2eaf2e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 21 Dec 2020 13:07:38 +0100 Subject: [PATCH] Add autocomplete support for multifactor backup code form field --- com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl | 2 +- .../files/acp/templates/__multifactorBackupCodeField.tpl | 2 +- .../lib/system/user/multifactor/backup/CodeFormField.class.php | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl b/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl index 1dde538f16..8f3a61ad64 100644 --- a/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl +++ b/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl @@ -3,7 +3,7 @@ *}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}{* - *}autocomplete="off" {* + *}{if $field->getAutoComplete() !== null}autocomplete="{$field->getAutoComplete()}" {/if}{* *}pattern="[0-9\s]*" {* *}inputmode="numeric"{* *}{if $field->getChunks() && $field->getChunkLength()} size="{$field->getChunks() - 1 + $field->getChunks() * $field->getChunkLength()}"{/if}{* diff --git a/wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl b/wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl index 1dde538f16..8f3a61ad64 100644 --- a/wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl +++ b/wcfsetup/install/files/acp/templates/__multifactorBackupCodeField.tpl @@ -3,7 +3,7 @@ *}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}{* - *}autocomplete="off" {* + *}{if $field->getAutoComplete() !== null}autocomplete="{$field->getAutoComplete()}" {/if}{* *}pattern="[0-9\s]*" {* *}inputmode="numeric"{* *}{if $field->getChunks() && $field->getChunkLength()} size="{$field->getChunks() - 1 + $field->getChunks() * $field->getChunkLength()}"{/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 1d42feee8d..b025ee9ba4 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 @@ -37,6 +37,7 @@ class CodeFormField extends TextFormField { $this->chunkLength(BackupMultifactorMethod::CHUNK_LENGTH); $this->minimumLength($this->getChunks() * $this->getChunkLength()); $this->addFieldClass('multifactorBackupCode'); + $this->autoComplete('off'); $placeholder = ''; $gen = Helper::digitStream(); -- 2.20.1