Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions com.woltlab.wcf/templates/shared_passwordFormField.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
document.getElementById('{unsafe:$fieldId|encodeJS}'),
{/foreach}
],
staticDictionary: [
{foreach from=$field->getStaticDictionary() item=staticDictionary}
'{unsafe:$staticDictionary|encodeJS}',
{/foreach}
],
Comment thread
BurntimeX marked this conversation as resolved.
});
});
</script>
Expand Down
1 change: 1 addition & 0 deletions wcfsetup/install/files/lib/form/NewPasswordForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ protected function createForm()
->addFieldClass('long')
->autocomplete('new-password')
->fieldAttribute('passwordrules', UserRegistrationUtil::getPasswordRulesAttributeValue())
->addStaticDictionary([$this->user->username, $this->user->email])
->addValidator(new FormFieldValidator(
'passwordValidator',
$this->validatePassword(...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
/**
* Implementation of a form field for a password.
*
* @author Matthias Schmidt
* @copyright 2001-2021 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 5.4
* @author Matthias Schmidt
* @copyright 2001-2025 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 5.4
*/
class PasswordFormField extends AbstractFormField implements
IAttributeFormField,
Expand Down Expand Up @@ -63,6 +63,12 @@ class PasswordFormField extends AbstractFormField implements
*/
protected array $relatedFieldsId = [];

/**
* @var string[]
Comment thread
BurntimeX marked this conversation as resolved.
* @since 6.2
*/
protected array $staticDictionary = [];

/**
* Creates a new instance of `PasswordFormField`.
*/
Expand Down Expand Up @@ -181,4 +187,24 @@ public function getRelatedFieldsIDs(): array

return $result;
}

/**
* @param string[] $staticDictionary
* @since 6.2
*/
public function addStaticDictionary(array $staticDictionary): static
{
$this->staticDictionary = \array_merge($this->staticDictionary, $staticDictionary);

return $this;
}

/**
* @return string[]
* @since 6.2
*/
public function getStaticDictionary(): array
{
return $this->staticDictionary;
}
}