Password generator examples 

Include special characters 

Example: qe8)i2W1it-msR8

A password generator using special chars.

A password generator using special chars.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_6' => [
            'label' => 'password_6',
            'description' => 'type=password fieldControl=passwordGenerator - all character sets',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random password',
                            'passwordRules' => [
                                'specialCharacters' => true,
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Only digits, length 8 (minimum length) 

Example: 28233371

A generated 8 digit number

A generated 8 digit number

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_7' => [
            'label' => 'password_7',
            'description' => 'type=password fieldControl=passwordGenerator length=8 - only digits',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random number',
                            'passwordRules' => [
                                'length' => 8,
                                'lowerCaseCharacters' => false,
                                'upperCaseCharacters' => false,
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Hexadecimal random bytes, length 30 

Example: 0d95c0936c54b97bf908a3c963b508.

A generated 30 characters long random hex string

A generated 30 characters long random hex string

The following example will generate a 30 characters long random hex string, which could be used for secret tokens or similar:

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_4' => [
            'label' => 'password_4',
            'description' => 'type=password fieldControl=passwordGenerator random=hex',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random hex string',
                            'passwordRules' => [
                                'length' => 30,
                                'random' => 'hex',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Base64 random bytes, readonly 

Example: zrt8sJd6GiqUI_EFgjPiedOj--D0NbTVOJz

A password generator using base64 random bytes, readonly

A password generator using base64 random bytes, readonly.

EXT:styleguide/Configuration/TCA/tx_styleguide_elements_basic.php
[
    'columns' => [
        'password_5' => [
            'label' => 'password_5',
            'description' => 'type=password fieldControl=passwordGenerator random=base64 allowEdit=false',
            'config' => [
                'type' => 'password',
                'fieldControl' => [
                    'passwordGenerator' => [
                        'renderType' => 'passwordGenerator',
                        'options' => [
                            'title' => 'Create random base64 string',
                            'allowEdit' => false,
                            'passwordRules' => [
                                'length' => 35,
                                'random' => 'base64',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
]
Copied!

Properties 

Field control options 

title 

title

title
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['title']
Type
String / localized string
Default
LLL:core.core:labels.generatePassword

Define a title for the control button.

allowEdit 

allowEdit

allowEdit
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['allowEdit']
Type
boolean
Default
true

If set to false, the user cannot edit the generated password.

Password policy 

passwordPolicy

passwordPolicy
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordPolicy']
Type
string
Default
default

New in version 14.2

This option can be used to configure which Password policy should be used for the password field. Use the key of the policy as defined in $GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies'] .

If the policy defines a generator section, the field control uses that generator.

EXT:my_extension/Configuration/TCA/Overrides/fe_users.php
<?php

$GLOBALS['TCA']['fe_users']['columns']['password']['config']['fieldControl']['passwordGenerator'] =
    [
        'passwordGenerator' => [
            'renderType' => 'passwordGenerator',
            'options' => [
                'passwordPolicy' => 'myCustomPolicy',
            ],
        ],
    ];
Copied!

Password rules 

Deprecated since version 14.2

The passwordRules option of the passwordGenerator field control has been deprecated. Password generation is now configured through Password policies registered in $GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies'] .

Define rules for the password.

Migration from passwordRules to password policies 

Replace the passwordRules option with a Password policiy reference.

EXT:my_extension/Configuration/TCA/Overrides/be_users.php
 'fieldControl' => [
     'passwordGenerator' => [
         'renderType' => 'passwordGenerator',
         'options' => [
-            'passwordRules' => [
-                'length' => 20,
-                'upperCaseCharacters' => true,
-                'lowerCaseCharacters' => true,
-                'digitCharacters' => true,
-                'specialCharacters' => false,
-            ],
+            'passwordPolicy' => 'myCustomPolicy',
         ],
     ],
 ],
Copied!

passwordRules.length 

passwordRules.length

passwordRules.length
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['length']
Type
int
Default
16
Minimum
8

Deprecated since version 14.2

Defines the amount of characters for the generated password.

passwordRules.random 

passwordRules.random

passwordRules.random
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['random']
Type
String
Values
"hex", "base64"

Deprecated since version 14.2

Defines the encoding of random bytes. Overrules character definitions.

"hex"
Generates a random password in hexadecimal format. Example: d0f4030d568ab483b8442735e9e3a7.
"base64"
Generates a random password in base64 format. Example: dtbpykd4vf1hda_Ag9kG983y-_N2zyLZzof.

passwordRules.digitCharacters 

passwordRules.digitCharacters

passwordRules.digitCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['digitCharacters']
Type
boolean
Default
true

Deprecated since version 14.2

If set to false, the generated password contains no digit.

passwordRules.lowerCaseCharacters 

passwordRules.lowerCaseCharacters

passwordRules.lowerCaseCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['lowerCaseCharacters']
Type
boolean
Default
true

Deprecated since version 14.2

If set to false, the generated password contains no lower case characters.

passwordRules.upperCaseCharacters 

passwordRules.upperCaseCharacters

passwordRules.upperCaseCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['upperCaseCharacters']
Type
boolean
Default
true

Deprecated since version 14.2

If set to false, the generated password contains no upper case characters.

passwordRules.specialCharacters 

passwordRules.specialCharacters

passwordRules.specialCharacters
Path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordRules']['specialCharacters']
Type
boolean
Default
false

Deprecated since version 14.2

If set to true, the generated password also contains special characters (!"#$%&'()*+,-./:;<=>?@[]^_{|} `).