private function validatePasswordFields(DataBag
$data, SalesChannelContext
$context): void
{ $definition =
new DataValidationDefinition('customer.password.update'
);
$minPasswordLength =
$this->systemConfigService->
get('core.loginRegistration.passwordMinLength',
$context->
getSalesChannel()->
getId());
$definition ->
add('newPassword',
new NotBlank(),
new Length(['min' =>
$minPasswordLength]),
new EqualTo(['propertyPath' => 'newPasswordConfirm'
])) ->
add('password',
new CustomerPasswordMatches(['context' =>
$context]));
$this->
dispatchValidationEvent($definition,
$data,
$context->
getContext());
$this->validator->
validate($data->
all(),
$definition);
$this->
tryValidateEqualtoConstraint($data->
all(), 'newPassword',
$definition);
} private function tryValidateEqualtoConstraint(array
$data, string
$field, DataValidationDefinition
$validation): void
{ $validations =
$validation->
getProperties();
if (!\
array_key_exists($field,
$validations)) {