Password 

New in version 13.0

The TCA type password should be used for input values that represent passwords.

The according database field is generated automatically.

Example: A basic password field: 

'config' => [
  'type' => 'password',
],
Copied!

Example: A password field with password generator 

The password of the live stream with its generator

The password of the live stream with its generator

EXT:my_extension/Configuration/TCA/Overrides/119-tx_myextension_conference-livestream_password.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
  'livestream_password' => [
    'label' => 'my_extension.db:conference.livestream_password',
    'displayCond' => 'FIELD:event_format:IN:online,hybrid',
    'config' => [
      'type' => 'password',
      'hashed' => false,
      'passwordPolicy' => 'default',
      'fieldControl' => [
        'passwordGenerator' => [
          'renderType' => 'passwordGenerator',
          'options' => [
            'passwordPolicy' => 'default',
          ],
        ],
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_conference',
  'livestream_password',
  '',
  'after:stream_url',
);
Copied!

For more options on generating passwords see Property passwordGenerator and the password generator examples.

Properties of the TCA column type password 

Name Type Scope
boolean Proc.
array Display
boolean
boolean Display
string Display / Proc.
array
array
array
boolean Proc.
string (keywords) Display
boolean Proc.
boolean Display
string Display / Proc.
string, hexadecimal password representation Display
boolean Display
boolean Display / Proc.
integer Display
behaviour
allowLanguageSynchronization
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

'behaviour' => [
  'allowLanguageSynchronization' => true,
],
Copied!
appearance
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['appearance']
Scope
Display
Added
15.0, Feature: #110851 - Copy a generated password to the clipboard

Has information about the appearance, namely:

copyToClipboard
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['appearance']['copyToClipboard']
Added
15.0, Feature: #110851 - Copy a generated password to the clipboard

Shows a button next to the input field. The button copies the password to the clipboard of the operating system.

The backend form shows a stored password only obfuscated, also when it is not hashed. The button therefore appears only when the field holds a new value: a password that is typed or generated. When the record is saved, the button is hidden again.

Enable the option for a generated password that editors cannot edit, see allowEdit. Editors cannot select the text of such a field, so the button is the only way to copy the password before the record is saved.

The generated secret of the ticket shop with a button to copy it

The generated secret of the ticket shop with a button to copy it

Example: Copy the generated secret of the ticket shop
EXT:my_extension/Configuration/TCA/Overrides/134-tx_myextension_conference-ticketing_secret.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
  'ticketing_secret' => [
    'label' => 'my_extension.db:conference.ticketing_secret',
    'config' => [
      'type' => 'password',
      'hashed' => false,
      'appearance' => [
        'copyToClipboard' => true,
      ],
      'fieldControl' => [
        'passwordGenerator' => [
          'renderType' => 'passwordGenerator',
          'options' => [
            'passwordPolicy' => 'secretToken',
            'allowEdit' => false,
          ],
        ],
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_conference',
  'ticketing_secret',
  '',
  'after:prices',
);
Copied!
autocomplete
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['autocomplete']
Scope
Display

By default, the autocomplete=new-password attribute will be added to the resulting input field. If autocomplete=true is configured in TCA, a autocomplete=current-password attribute will be added to the element.

'autocomplete' => true,
Copied!
default
Type
string
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
Scope
Display / Proc.

Default value set if a new record is created. If empty, no password gets selected.

fieldControl

For details see fieldControl.

fieldInformation

For details see fieldInformation.

fieldWizard
defaultLanguageDifferences
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

hashed
Type
boolean
Default
true
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['hashed']
Scope
Proc.

If hashed is set to false , if the field value will be saved as plaintext to the database.

Example: A password that must stay readable to be sent to the ticket holders
EXT:my_extension/Configuration/TCA/Overrides/119-tx_myextension_conference-livestream_password.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
  'livestream_password' => [
    'label' => 'my_extension.db:conference.livestream_password',
    'displayCond' => 'FIELD:event_format:IN:online,hybrid',
    'config' => [
      'type' => 'password',
      'hashed' => false,
      'passwordPolicy' => 'default',
      'fieldControl' => [
        'passwordGenerator' => [
          'renderType' => 'passwordGenerator',
          'options' => [
            'passwordPolicy' => 'default',
          ],
        ],
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_conference',
  'livestream_password',
  '',
  'after:stream_url',
);
Copied!
mode
Type
string (keywords)
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL .

nullable
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['nullable']
Scope
Proc.

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL .

The database field must allow the NULL value.

Example: A nullable password field
'nullable' => true,
Copied!
passwordGenerator
Type
boolean
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']
Scope
Display

The control renders a button next to the password field allowing the user to generate a random password based on defined rules.

Using the control adds the generated password to the corresponding field. The password is visible to the backend user only once and stored encrypted in the database. Integrators are also able to define whether the user is allowed to edit the generated password before saving.

The password of the live stream with a generated password

The password of the live stream with a generated password

The same field after saving, the password is hidden

The same field after saving: the password is hidden

EXT:my_extension/Configuration/TCA/Overrides/119-tx_myextension_conference-livestream_password.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
  'livestream_password' => [
    'label' => 'my_extension.db:conference.livestream_password',
    'displayCond' => 'FIELD:event_format:IN:online,hybrid',
    'config' => [
      'type' => 'password',
      'hashed' => false,
      'passwordPolicy' => 'default',
      'fieldControl' => [
        'passwordGenerator' => [
          'renderType' => 'passwordGenerator',
          'options' => [
            'passwordPolicy' => 'default',
          ],
        ],
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_conference',
  'livestream_password',
  '',
  'after:stream_url',
);
Copied!
passwordPolicy
Type
string
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordPolicy']
Scope
Display / Proc.

This option assigns a password policy to fields of the type password. For configured fields, the password policy validator will be used in DataHandler to ensure, that the new password complies with the configured password policy.

Password policy requirements are shown below the password field, when the focus is changed to the password field.

See also: the password policy examples.

placeholder
Type
string, hexadecimal password representation
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder, containing a hexadecimal password representation.

'placeholder' => 'Choose a password',
Copied!
readOnly
Type
boolean
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the value but cannot edit it.

required
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['required']
Scope
Display / Proc.

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

size
Type
integer
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['size']
Scope
Display

Abstract value for the width of the <input> field. To set the password field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.