Examples for using different password policies in TCA

Use the default policy

<?php

$passwordField = [
    'config' => [
        'label' => 'Your Password',
        'config' => [
            'type' => 'password',
            'passwordPolicy' => 'default',
        ],
    ],
];
Copied!

Use the globally defined policy for frontend

<?php

$passwordField = [
    'config' => [
        'label' => 'Your Password',
        'config' => [
            'type' => 'password',
            'passwordPolicy' => $GLOBALS['TYPO3_CONF_VARS']['FE']['passwordPolicy'] ?? '',
        ],
    ],
];
Copied!

Use the globally defined policy for backend

<?php

$passwordField = [
    'config' => [
        'label' => 'Your Password',
        'config' => [
            'type' => 'password',
            'passwordPolicy' => $GLOBALS['TYPO3_CONF_VARS']['BE']['passwordPolicy'] ?? '',
        ],
    ],
];
Copied!