forked from GNUsocial/gnu-social
[UTIL][FormFields] Accomodate use of FormFields::repeated_password without a 'required' option
This commit is contained in:
parent
1dd86a2302
commit
fe755f7c42
@ -18,12 +18,13 @@ abstract class FormFields
|
|||||||
{
|
{
|
||||||
public static function repeated_password(array $options = []): array
|
public static function repeated_password(array $options = []): array
|
||||||
{
|
{
|
||||||
$constraints = (array_key_exists('required', $options) && $options['required'] === false) ? []
|
$constraints = ($options['required'] ?? true)
|
||||||
: [
|
? [
|
||||||
new NotBlank(['message' => _m('Please enter a password')]),
|
new NotBlank(['message' => _m('Please enter a password')]),
|
||||||
new Length(['min' => Common::config('password', 'min_length'), 'minMessage' => _m(['Your password should be at least # characters'], ['count' => Common::config('password', 'min_length')]),
|
new Length([
|
||||||
|
'min' => Common::config('password', 'min_length'), 'minMessage' => _m(['Your password should be at least # characters'], ['count' => Common::config('password', 'min_length')]),
|
||||||
'max' => Common::config('password', 'max_length'), 'maxMessage' => _m(['Your password should be at most # characters'], ['count' => Common::config('password', 'max_length')]), ]),
|
'max' => Common::config('password', 'max_length'), 'maxMessage' => _m(['Your password should be at most # characters'], ['count' => Common::config('password', 'max_length')]), ]),
|
||||||
];
|
] : [];
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'password', RepeatedType::class,
|
'password', RepeatedType::class,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user