Skip to content

Commit 73662ca

Browse files
authored
[FEATURE] Add default password generator wizard for FE and BE users (#1403)
References: TYPO3-Documentation/Changelog-To-Doc#1622 Releases: main, 14.3
1 parent 5f33ad5 commit 73662ca

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

Documentation/ColumnsConfig/Type/Password/PasswordGenerator.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,70 @@ allowEdit
106106

107107
If set to :php:`false`, the user cannot edit the generated password.
108108

109+
.. _columns-password-properties-passwordGenerator-passwordPolicy:
110+
111+
Password policy
112+
===============
113+
114+
.. confval:: passwordPolicy
115+
:name: password-passwordGenerator-passwordPolicy
116+
:Path: :php:`$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['passwordGenerator']['options']['passwordPolicy']`
117+
:Type: string
118+
:Default: `default`
119+
120+
.. versionadded:: 14.2
121+
122+
This option can be used to configure which
123+
`Password policy <https://docs.typo3.org/permalink/t3coreapi:password-policies>`_
124+
should be used for the password field. Use the key of the policy as
125+
defined in :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies']`.
126+
127+
If the policy defines a `generator`
128+
section, the field control uses that generator.
129+
130+
.. literalinclude:: _Snippets/_PasswordPolicy.php
131+
:caption: EXT:my_extension/Configuration/TCA/Overrides/fe_users.php
132+
133+
109134
.. _columns-password-properties-passwordGenerator_passwordRules:
110135

111136
Password rules
112137
==============
113138

139+
.. deprecated:: 14.2
140+
The `passwordRules` option of the `passwordGenerator` field control has been
141+
deprecated. Password generation is now configured through
142+
`Password policies <https://docs.typo3.org/permalink/t3coreapi:password-policies>`_
143+
registered in :php:`$GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies']`.
144+
114145
Define rules for the password.
115146

147+
.. _columns-password-properties-passwordGenerator_passwordRules-migration:
148+
149+
Migration from `passwordRules` to password policies
150+
---------------------------------------------------
151+
152+
Replace the `passwordRules` option with a `Password policiy <https://docs.typo3.org/permalink/t3coreapi:password-policies>`_ reference.
153+
154+
.. code-block:: diff
155+
:caption: EXT:my_extension/Configuration/TCA/Overrides/be_users.php
156+
157+
'fieldControl' => [
158+
'passwordGenerator' => [
159+
'renderType' => 'passwordGenerator',
160+
'options' => [
161+
- 'passwordRules' => [
162+
- 'length' => 20,
163+
- 'upperCaseCharacters' => true,
164+
- 'lowerCaseCharacters' => true,
165+
- 'digitCharacters' => true,
166+
- 'specialCharacters' => false,
167+
- ],
168+
+ 'passwordPolicy' => 'myCustomPolicy',
169+
],
170+
],
171+
],
172+
116173
.. _columns-password-properties-passwordGenerator_passwordRules_length:
117174

118175
passwordRules.length
@@ -125,6 +182,8 @@ passwordRules.length
125182
:Default: :php:`16`
126183
:Minimum: :php:`8`
127184

185+
.. deprecated:: 14.2
186+
128187
Defines the amount of characters for the generated password.
129188

130189
.. _columns-password-properties-passwordGenerator_passwordRules_random:
@@ -138,6 +197,8 @@ passwordRules.random
138197
:Type: String
139198
:Values: :php:`"hex"`, :php:`"base64"`
140199

200+
.. deprecated:: 14.2
201+
141202
Defines the encoding of random bytes. Overrules character definitions.
142203

143204
:php:`"hex"`
@@ -166,6 +227,8 @@ passwordRules.digitCharacters
166227
:Type: boolean
167228
:Default: :php:`true`
168229

230+
.. deprecated:: 14.2
231+
169232
If set to :php:`false`, the generated password contains no digit.
170233

171234
.. _columns-password-properties-passwordGenerator_passwordRules_lowercasecharacters:
@@ -180,6 +243,8 @@ passwordRules.lowerCaseCharacters
180243
:Type: boolean
181244
:Default: :php:`true`
182245

246+
.. deprecated:: 14.2
247+
183248
If set to :php:`false`, the generated password contains no lower case characters.
184249

185250
.. _columns-password-properties-passwordGenerator_passwordRules_uppercasecharacters:
@@ -193,6 +258,8 @@ passwordRules.upperCaseCharacters
193258
:Type: boolean
194259
:Default: :php:`true`
195260

261+
.. deprecated:: 14.2
262+
196263
If set to :php:`false`, the generated password contains no upper case characters.
197264

198265
.. _columns-password-properties-passwordGenerator_passwordRules_specialcharacters:
@@ -206,5 +273,7 @@ passwordRules.specialCharacters
206273
:Type: boolean
207274
:Default: :php:`false`
208275

276+
.. deprecated:: 14.2
277+
209278
If set to :php:`true`, the generated password also contains special
210279
characters (`!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~`).
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
$GLOBALS['TCA']['fe_users']['columns']['password']['config']['fieldControl']['passwordGenerator'] =
4+
[
5+
'passwordGenerator' => [
6+
'renderType' => 'passwordGenerator',
7+
'options' => [
8+
'passwordPolicy' => 'myCustomPolicy',
9+
],
10+
],
11+
];

0 commit comments

Comments
 (0)