Skip to content

Commit

Permalink
[TASK] Allow passwordGenerator in all TCA types
Browse files Browse the repository at this point in the history
FormEngine fieldControl "passwordGenerator" can be
handy with TCA type="input" as well.

The patch removes a restriction in PasswordGenerator
that binds this fieldControl exclusively to TCA
type="password".

Resolves: #101703
Related: #98540
Releases: main, 12.4
Change-Id: Ice09e0af2269d5f0aad5afa2d08215d51a04e394
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80653
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
fe-hicking authored and lolli42 committed Aug 23, 2023
1 parent d742e21 commit ff5854a
Showing 1 changed file with 7 additions and 8 deletions.
Expand Up @@ -22,21 +22,20 @@
use TYPO3\CMS\Core\Utility\StringUtility;

/**
* Renders a widget where a password can be generated, typically used with type=password
* Renders a widget to generate a random string in JavaScript.
*
* @internal Only to be used by TYPO3. Might change in the future.
* This is typically used in combination with TCA type=password as password
* generator, but can be potentially used with other field input types as well.
*
* @internal This is still a bit experimental and may change, for instance to
* be combined with passwordPolicies.
*/
class PasswordGenerator extends AbstractNode
{
public function render(): array
{
$parameterArray = $this->data['parameterArray'];
if (($parameterArray['fieldConf']['config']['type'] ?? '') !== 'password') {
return [];
}

$options = $this->data['renderData']['fieldControlOptions'];
$itemName = (string)$parameterArray['itemFormElName'];
$itemName = (string)$this->data['parameterArray']['itemFormElName'];
$id = StringUtility::getUniqueId('t3js-formengine-fieldcontrol-');

// Handle options and fallback
Expand Down

0 comments on commit ff5854a

Please sign in to comment.