Issue Feature Closed

#97389Add Password Policy check to FormEngine (TCA type=password) and DataHandler

Torben Hansen 04/15/22, 05:50 updated 04/05/23, 09:53

Description

Evaluate password policy for mode (either FE or BE) in TCA type=password for the configured Password Policy.

Example TCA for be_users

$GLOBALS['TCA']['be_users']['columns']['password'] = [
    'config' => [
        'type' => 'password',
        'size' => 20,
        'required' => true,

        // could be the default behavior when omitted for `type=password` in DataHandler,
        'passwordPolicy' => 'default',

        'fieldControl' => [
            // checks requirements of `passwordPolicy`, visualized matches & mismatches
            'passwordPolicyValidation' => true,

            // just concerns the entropy of a password, independent of `passwordPolicy`
            'passwordStrengthMeter' => true,

            // uses aspects of `passwordPolicy` and shows a visual generator
            // (e.g. user can select amount of digits, amount of special chars, ...)
            'passwordGenerator' => true,
        ],
    ],
];

Example TCA for sys_reaction

$GLOBALS['TCA']['sys_reaction']['columns']['token'] = [
    'config' => [
        'type' => 'password',
        'size' => 20,
        'required' => true,

        'passwordPolicy' => 'token',

        'fieldControl' => [
            // checks requirements of `passwordPolicy`, visualized matches & mismatches
            'passwordPolicyValidation' => true,

            // just concerns the entropy of a password, independent of `passwordPolicy`
            'passwordStrengthMeter' => true,

            // uses aspects of `passwordPolicy` and shows a visual generator
            // (e.g. user can select amount of digits, amount of special chars, ...)
            'passwordGenerator' => [
                'controls' => false,
                'randomValue' => true,
                'convert' => ['hex', 'base64'],
            ],
        ],
    ],
];

For the latter, we need to add an additional global password policy named token as shown below:

'token' => [
    'validators' => [
        \TYPO3\CMS\Core\PasswordPolicy\Validator\CorePasswordValidator::class => [
            'options' => [
                'minimumLength' => 40,
            ],
            'excludeActions' => [],
        ],
],

Reviews 1